1
A 연락처의 E 메일 주소를 가져 오려고합니다. How to get contact email id?을 찾았지만 사용할 수 없습니다.A 연락처의 E 메일 ID를 가져 오는 방법
나는 예외 다음하고 이메일로
Cursor c1;
c1 = getContentResolver().query(ContactsContract.Contacts.CONTENT_URI, null, null, null, ContactsContract.Contacts.DISPLAY_NAME);
if(c1==null)
return;
if(c1.getCount() > 0)
{
while(c1.moveToNext())
{
String id = c1.getString(c1.getColumnIndex(Contacts._ID));
if(id==null)
continue;
Cursor email_crsr = getContentResolver().query(CommonDataKinds.Email.CONTENT_URI, null, CommonDataKinds.Phone.CONTACT_ID +" = ?", new String[]{id}, null);
if(email_crsr!=null)
email = phone_crsr.getString(phone_crsr.getColumnIndex(CommonDataKinds.Email.DATA));
}
}
를 가져 코드를 다음 쓴 : 04-09 10 : 38 : 59.487 : E/AndroidRuntime (8150) : android.database.CursorIndexOutOfBoundsException :에 의해 발생 : 인덱스 -1 4