1. Download our Official Android App: Forums for Android!

Apps ContactList

Discussion in 'Android Development' started by perica0001, Dec 1, 2009.

  1. perica0001

    perica0001 Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    1
    Joined:
    Nov 30, 2009

    Nov 30, 2009
    1
    0
    5
    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 Lurker
    Rank:
    None
    Points:
    5
    Posts:
    2
    Joined:
    Dec 5, 2009

    Dec 5, 2009
    2
    0
    5
    I am in the same situation.
     
  3. Broto25

    Broto25 Lurker
    Rank:
    None
    Points:
    5
    Posts:
    6
    Joined:
    Dec 7, 2009

    Dec 7, 2009
    6
    0
    5
    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...