Hi, I am new beginner in android developing and I have some beginner questions. I want to make context menu on contacts (in my phone) but I don't no how to get Contact List in my applications. I don't no how to get contacts... Can anybody help me to solve this problem ? Of course if somebody know some link or .pdf file for beginners let me know and post this here. Tnx!
Cursor peopleCursor = managedQuery( ContactsContract.Contacts.CONTENT_URI, null, null, null, null); while (peopleCursor.moveToNext()) { String id = peopleCursor.getString(peopleCursor .getColumnIndex(ContactsContract.Contacts._ID)); String name = peopleCursor.getString(peopleCursor .getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME)); String hasPhoneNumberFlag = peopleCursor .getString(peopleCursor .getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER)); } Doing it you get all the contacts from your phone ( ID, NAME and a Flag saying if this contact's got any phone numbers) . It's just one way to get all the contacts one by one!