A dû changer un peu du tutoriel sur Content Providers puisqu'il a référencé des classes obsolètes, ceci pourrait aider.
import android.provider.ContactsContract.Contacts;
import android.database.Cursor;
// Form an array specifying which columns to return, you can add more.
String[] projection = new String[] {
ContactsContract.Contacts.DISPLAY_NAME,
ContactsContract.CommonDataKinds.Phone
ContactsContract.CommonDataKinds.Email
};
Uri contacts = ContactsContract.Contacts.CONTENT_LOOKUP_URI;
// id of the Contact to return.
long id = 3;
// Make the query.
Cursor managedCursor = managedQuery(contacts,
projection, // Which columns to return
null, // Which rows to return (all rows)
// Selection arguments (with a given ID)
ContactsContract.Contacts._ID = "id",
// Put the results in ascending order by name
ContactsContract.Contacts.DISPLAY_NAME + " ASC");
@Octavian: Je ne suis pas sûr d'être d'accord avec la suppression de * Android * du titre de la question. Cela semble être une occurrence assez commune pour les questions sur d'autres technologies. Cela peut être une question d'édition pour meta – NotMe
@ChrisLively Je dois admettre que vous pourriez avoir raison sur celui-ci. Je vais le changer. –