2012-03-29 18 views
1

我只想獲得給出電話號碼的用戶的電子郵件ID。 所以我必須得到電子郵件ID的用戶,其編號是986879899.so PLZ建議我解決這個問題或從我得到解決方案的任何鏈接。如何獲取Android中我的聯繫人列表中的人的電子郵件ID

我想補充一點,如何讓人聯繫號碼。通過引用我的聯繫人列表中的人名從我的電話中刪除。

+5

哈哈!你想窺探你的GF? – uday 2012-03-29 06:04:53

+0

我不認爲這是可能的。電子郵件ID和電話號碼的數據庫將是一個巨大的隱私問題。 – 2012-03-29 06:06:06

+0

我得到了一個解決方案,在CIA或FBI或NSA找到工作,你將能夠找到更多的方式,然後從該電話號碼發送電子郵件ID。 – Mayank 2012-03-29 06:06:37

回答

2
This is the solution of the above problem. Ashutosh given me the solution of the problem. 


Cursor emails = getContentResolver().query(ContactsContract.CommonDataKinds.Email.CONTENT_URI, null, ContactsContract.CommonDataKinds.Email.CONTACT_ID + " = " + contactId, null, null); 
     while (emails.moveToNext()) { 
      // This would allow you get several email addresses 
      String emailAddress = emails.getString( 
      emails.getColumnIndex(ContactsContract.CommonDataKinds.Email.DATA)); 
     System.out.println("email address might be"+emailAddress); 
     } 
     emails.close(); 

     Thanks Ashutosh :) 
0

它會是這樣的

Cursor cursor = context.getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, ContactsContract.CommonDataKinds.Phone.NUMBER + " = ?", new String[]{"986879899"}, null); 

cursor.moveToFirst(); 

cursor.getString(cursor.getColumnIndexOrThrow(PhoneLookup.Email)); 

你需要添加允許閱讀聯繫人雖然

相關問題