Jump to content

Récupérer numéro de téléphone de ses contacts


hugobosscool26

Recommended Posts

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 by hugobosscool26
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...