hugobosscool26 Posted January 23, 2010 Share Posted January 23, 2010 (edited) Bonjour à tous, Je voudrais récupérer le nom de mes contacts dans mon téléphone mais malheureusement en 2.1, ce code ci ne fonctionne plus alors qu'en 1.6 tout est correcte : Cursor cursor = getBaseContext().getContentResolver().query(People.CONTENT_URI, null, null, null, People.DISPLAY_NAME); // Use the convenience properties to get the index of the columns int nameIdx = cursor.getColumnIndexOrThrow(People.NAME); int personID = cursor.getColumnIndexOrThrow(People._ID); int numberID = cursor.getColumnIndexOrThrow(People.NUMBER); if (cursor.moveToFirst()) { do { // Extract the name. String name = cursor.getString(nameIdx); String id = cursor.getString(personID); String numero = cursor.getString(numberID); Mescontacts.add("Name "+name+" Numero "+numero); } while(cursor.moveToNext()); } Par contre, je récupére bien le nom de mes contacts... Des idées svp ? Edited January 23, 2010 by hugobosscool26 Quote Link to comment Share on other sites More sharing options...
Antares Posted January 25, 2010 Share Posted January 25, 2010 Je pense que ça vient du fait que la classe est deprecated : http://developer.android.com/intl/fr/reference/android/provider/Contacts.People.html Il faut plutôt aller voir du côté de ContactsContract : http://developer.android.com/intl/fr/reference/android/provider/ContactsContract.html Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.