У меня есть следующий код, чтобы получить детали контакта.
«данные»: это Uri, который я получаю после выбора контакта.
Мне нужно быть уверенным, что я получу правильный контакт в будущем, так что я должен сохранить для будущего использования? Это "lookupUri" или "lookupKey"?
Cursor c = activity.managedQuery(data, null, null, null, null);
c.moveToFirst();
String lookupKey = c.getString(c.getColumnIndex(ContactsContract.Contacts.LOOKUP_KEY ));
c.close();
// Next use that key to access the details of the contact in order to get the name and the photo
// Also, save it for future use.
// It will be used when we fetch the details from the database since the photo itself is not saved.
Uri lookupUri = Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_LOOKUP_URI,lookupKey);
Uri uri = ContactsContract.Contacts.lookupContact(activity.getContentResolver(), deviceDetails.lookupUri);