ContactList


Last Updated:

  1. perica0001

    perica0001 New Member This Topic's Starter

    Joined:
    Nov 30, 2009
    Messages:
    1
    Likes Received:
    0
    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!
     

    Advertisement
  2. racsus

    racsus New Member

    Joined:
    Dec 5, 2009
    Messages:
    2
    Likes Received:
    0
    I am in the same situation.
     
  3. Broto25

    Broto25 Member

    Joined:
    Dec 7, 2009
    Messages:
    6
    Likes Received:
    0
    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!
     

Share This Page

Loading...