Fetch Contacts in android application

前端 未结 5 488
谎友^
谎友^ 2020-12-15 07:17

I was following these links to get the contacts in my application

How to call Android contacts list?

http://www.higherpass.com/Android/Tutorials/Working-Wit

5条回答
  •  暖寄归人
    2020-12-15 08:14

    In here you have got the cursor c

    Cursor c = getContentResolver().query(Phones.CONTENT_URI, null, null,null, null);
    

    to get the name

    String name = c.getString(c.getColumnIndex(People.NAME));
    

    to get the number

    String number = c.getString(c.getColumnIndex(People.NUMBER));
    

    You can iterate through the cursor and save them to a list. Create a checkbox list view and bind with that list.

提交回复
热议问题