Bonjour

j'aimerais afficher les Noms et les Numeros des Contact et les affichers chacun dans check box..j'ai essayé ce code mais ça marche pas.voici le code:
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
27
28
29
30
31
32
33
34
35
 
	CheckBox ch1;
	String name;
	String number;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main1);
		Button save = (Button) findViewById(R.id.bSave);
		Button retur = (Button) findViewById(R.id.bReturn);
		retur.setOnClickListener(this);
		ch1= (CheckBox)findViewById(R.id.checkBox1);
 
	int i=0;	
 
Uri uri = ContactsContract.CommonDataKinds.Phone.CONTENT_URI;
String[] projection    = new String[] {ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME,ContactsContract.CommonDataKinds.Phone.NUMBER};
 
	Cursor people = getContentResolver().query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null);
 
	int indexName = people.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME);
	int indexNumber = people.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER);
 
	people.moveToFirst();
	do {
	   name   = people.getString(indexName);
	    number = people.getString(indexNumber);
	    String s= name+"  :  "+number;
	    ch1.setText(s);
	    i++;
	}while(i<1);
	//} while (people.moveToNext());
	people.close();
	}
Merci