my purpose to retrieve the list of contacts (name, number) is recorded in a json object, to send via web service to the server
then I found the code to visit contact
here my code
public static Map getAddressBook(Context context)
{
Map result = new HashMap();
Cursor cursor = context.getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, null, null, null);
while(cursor.moveToNext())
{
int phone_idx = cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER);
int name_idx = cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME);
String phone = cursor.getString(phone_idx);
String name = cursor.getString(name_idx);
result.put(name, phone);
}
cursor.close();
return result;
}
and need