This question hasn't been answered since they deprecated the Contacts.People
type, and all the answers I could find still involve its use. How can it be done without using People.NAME
and People.NUMBER
?
In other words, I already know that you can start the Contact List with:
Intent intent = new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI);
startActivityForResult(intent, 1);
...and then you have to create a method called onActivityResult, which has to look like this:
public void onActivityResult(int reqCode, int resultCode, Intent data) {
super.onActivityResult(reqCode, resultCode, data);
switch (reqCode) {
case (1):
if (resultCode == Activity.RESULT_OK) {
Uri contactData = data.getData();
Cursor c = this.getContentResolver()
.query(contactData,
null,
null,
null,
null);
if (c.moveToFirst()) {
int contact_id = c.getInt(c
.getColumnIndexOrThrow(ContactsContract.?????????));
}
}
break;
}
}
...so, what non-deprecated column names should I expect to find in Cursor c
? I can't find any updated documentation on this, and Google only returns examples with deprecated People.NAME
and People.NUMBER
columns.
The ContactsContract
class is a Byzantine morass of... stuff, in which I can't find anything that looks like it has anything to do with People.NAME
or People.NUMBER
, so answers that say "just read the documentation for ContactsContract
" are completely unhelpful.
Perhaps there is little point in editing this in after it's already been marked as [duplicate], since nobody will ever read it.
Worst of all, since I can't comment, I can't ask for clarification on other versions of this question. I have to ask a new question.