开发者

View and add contact in created application

开发者 https://www.devze.com 2023-02-02 08:08 出处:网络
I am creating an Android application which requires to view contacts from phone\'s contact a开发者_运维问答nd add contacts or sync it into my application. Is it possible to do this? How?

I am creating an Android application which requires to view contacts from phone's contact a开发者_运维问答nd add contacts or sync it into my application. Is it possible to do this? How?

Thanks..


Yes, absolutely possible use content resolver and cursor

e.g. Reading contacts names

    Cursor cursor = getContentResolver().
    query( Contacts.CONTENT_URI, 
      new String[]{Contacts.DISPLAY_NAME}, null, null,null);

    if(cursor!=null){
      while(cursor.moveToNext()){

         String name = cursor.getString(cursor.getColumnIndex(Contacts.DISPLAY_NAME))
       }

Use following link for more information

http://developer.android.com/guide/topics/providers/content-providers.html

0

精彩评论

暂无评论...
验证码 换一张
取 消