Mon code ci dessous permet d'afficher dans un liste view la liste des contacts de téléphone mais j'ai pas pu afficher le numero y avec.
C'est mon premier projet android.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
 
private void populateContactList() {
		// Build adapter with contact entries
		Cursor cursor = getContacts();
		String[] fields = new String[] {ContactsContract.Data.DISPLAY_NAME};
 
		SimpleCursorAdapter adapter = new SimpleCursorAdapter(this,
				R.layout.contact_entry, cursor, fields,
				new int[] { R.id.contactEntryText });
		mContactList.setAdapter(adapter);
	}
 
	// -----------------------------------------
	private Cursor getContacts() {
		// Run query
		Uri uri = ContactsContract.Contacts.CONTENT_URI;
		String[] projection = new String[] { ContactsContract.Contacts._ID,
				ContactsContract.Data.DISPLAY_NAME };
		// String selection = ContactsContract.Contacts.IN_VISIBLE_GROUP ;
 
		String[] selectionArgs = null;
		String sortOrder = ContactsContract.Data.DISPLAY_NAME
				+ " COLLATE LOCALIZED ASC";
 
		return managedQuery(uri, projection, null, selectionArgs, sortOrder);
	}