Cursor cursor = Cr. Query (contactscontract. Contacts. content_uri, null,
Null, null, null );
List <string> numbers = NULL;
While (cursor. movetonext ()){
Numbers = new arraylist <string> ();
// Obtain the contact
Int namefieldcolumnindex = cursor
. Getcolumnindex (phonelookup. display_name );
String name = cursor. getstring (namefieldcolumnindex );
// obtain the id
int idfieldcolumnindex = cursor
. getcolumnindex (contactscontract. contacts. _ id);
string contactid = cursor. getstring (idfieldcolumnindex);
system. out. println ("contactid --->" + contactid);
// obtain the phone number
cursor phones = CR
. query (contactscontract. commondatakinds. phone. content_uri,
null, contactscontract. commondatakinds. phone. contact_id + "="
+ contactid, null, null);
System. Out. println ("phones --->" + phones. getcount ());
While (phones. movetonext ()){
Int phonefieldcolumnindex = phones
. Getcolumnindex (contactscontract. commondatakinds. Phone. number );
String phonenum = phones. getstring (phonefieldcolumnindex );
System. Out. println ("numbers ---" + phonenum );
Numbers. Add (phonenum );
}