'android'에 해당되는 글 4건

  1. 2010.06.30 [android] - Log 사용하기
  2. 2010.06.29 [android] - XML 가지고 놀기
  3. 2010.06.29 [android] - AlertDialog 사용하기
  4. 2010.06.29 [android] - Intent

Anroid 를 시작하면서 가장 당황한 부분이.. System.out.print() 로 로그를 볼 수 없다는 것이다.


대신 유용한 넘으로 Log가 있다.


Log.v() 를 이용하여 로그를 작성하면 console 창에 나올거 같지만.. 쩌ㅃ~ LogCat 창이 따로 존재한다.


Window-Show View-Android-LogCat 선택

 

Example
Log.v("bbaeggar", "grid position : " + gridView.getSelectedItemPosition() );


'android' 카테고리의 다른 글

[android] - XML 가지고 놀기  (0) 2010.06.29
[android] - AlertDialog 사용하기  (0) 2010.06.29
[android] - Intent  (0) 2010.06.29
Posted by 짱가쟁이
구글링중 쓸만한 기사가 있어서 올린다.

Working with XML on Android : http://www.ibm.com/developerworks/library/x-android/

'android' 카테고리의 다른 글

[android] - Log 사용하기  (0) 2010.06.30
[android] - AlertDialog 사용하기  (0) 2010.06.29
[android] - Intent  (0) 2010.06.29
Posted by 짱가쟁이

사용 예
package com.demo.grid;

import android.app.AlertDialog;
import android.content.DialogInterface;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;

public class GridViewOnItemClickListener implements OnItemClickListener {
    @Override
    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
      AlertDialog dlg = new AlertDialog.Builder(parent.getContext()).create();
      dlg.setTitle("타이틀");
      dlg.setMessage(position + " 번째 item 을 선택했습니다."); 
      dlg.setCancelable(false);
      dlg.setButton("OK", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int whichButton) {
             dialog.cancel();
        }
      });
      dlg.show();
    }
}

'android' 카테고리의 다른 글

[android] - Log 사용하기  (0) 2010.06.30
[android] - XML 가지고 놀기  (0) 2010.06.29
[android] - Intent  (0) 2010.06.29
Posted by 짱가쟁이
2010. 6. 29. 15:17
Intent는 component(activities, services, broadcast receivers) 를 활성화할 때 사용되는 비동기 메시지이다.

예를 들어, 단순한 텍스트 기반의 리스트가 있다고 가정하자. 이 때 리스트에서 특정 item을 선택(push) 하 면 상세페이지로 전화되고 그 화면에 리스트 item을 전달하고 싶으면 어떻게 해야 할까? 이때 사용하는 넘이 Intent 다.

사용 예
- 상세 화면 Active 코드
Intent myIntent = new Intent();
myIntent.setClassName("com.example.helloandroid", "com.example.helloandroid.DetailView");
myIntent.putExtra("key", l.getItemAtPosition(position).toString());

startActivity(myIntent);

Mainfest.xml 설정
- mainfest.xml 안에 상세 화면 Activity 를 선언해야지 사용할 수 있다.
- 참조 :  http://developer.android.com/reference/android/content/Intent.html
<activity android:name=".DetailView"
          android:label="@string/app_name">
    <intent-filter>
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
    </intent-filter>
</activity>

'android' 카테고리의 다른 글

[android] - Log 사용하기  (0) 2010.06.30
[android] - XML 가지고 놀기  (0) 2010.06.29
[android] - AlertDialog 사용하기  (0) 2010.06.29
Posted by 짱가쟁이
이전버튼 1 이전버튼