我想要的聯繫人,其中包括(FAMILY_NAME,GIVEN_NAME,MIDDLE_NAME,PHONETIC_FAMILY_NAME,PHONETIC_GIVEN_NAME,PHONETIC_MIDDLE_NAME,前綴,後綴)的名稱。如何獲得聯繫人姓名信息的特定聯繫人
我知道,與
android.provider.ContactsContract.CommonDataKinds.StructuredName
開始上述數據的列名,但我無法得到數據的URI。
我工作的設備符合API級別8,所以我想用
android.provider.ContactsContract
我在commumnity搜索這個獲取這些詳細信息,但我不能讓預期的結果。
我在這工作了4個小時。
任何幫助將不勝感激。
我使用此代碼提前
Cursor cursor = activity.managedQuery(android.provider.ContactsContract.Contacts.CONTENT_URI, null, null, null, null);
if (cursor != null)
{
if (cursor.moveToFirst())
{
int rows = cursor.getCount();
int cols = cursor.getColumnCount();
do
{
int _id = cursor.getInt(cursor.getColumnIndex("_id"));
int times_contacted = cursor.getInt(cursor.getColumnIndex("times_contacted"));
int has_phone_number = cursor.getInt(cursor.getColumnIndex("has_phone_number"));
int send_to_voicemail = cursor.getInt(cursor.getColumnIndex("send_to_voicemail"));
int starred = cursor.getInt(cursor.getColumnIndex("starred"));
// Here i want the contact names But i dont know what column name i have to pass to get them
}
while (cursor.moveToNext());
}
cursor.close();
}
感謝。
工作謝謝你的回答 –
非常感謝..................................... .......... –
歡迎好友... :-) – user370305