View and add contact in created application
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
精彩评论