블로그 이미지
SuperMjs

calendar

1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28

Notice

연락처 목록 화면을 호출하는 부분

Intent intent = new Intent(Intent.ACTION_PICK); 
intent.setData(ContactsContract.CommonDataKinds.Phone.CONTENT_URI);
또는 intent
.setData(Uri.parse("content://com.android.contacts/data/phones")); 
startActivityForResult(intent, 0);




연락처 목록 화면에서 선택된 결과를 반영하는 부분

Cursor cursor = getContentResolver().query(data.getData(), 

    new String[]{ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME

ContactsContract.CommonDataKinds.Phone.NUMBER}, null, null, null);

cursor.moveToFirst();

mTelephone.setText(cursor.getString(1));
//cursor.getString(0)의 경우 선택된 아이템의 이름을 가지고 온다. 

cursor.close();

 
posted by SuperMjs