Android 通讯录学习笔记之——目标:调用系统通讯录的编辑功能

资料来源:http://www.eoeandroid.com/thread-37271-1-1.html


代码功能:调用系统自带的编辑联系人功能

代码片段

    // 如下用法在ANADOIR 2.3.6上面会报 “Caused by: android.database.sqlite.SQLiteException: no such column: raw_contact_id:” 异常 
     Intent intent = new Intent(Intent.ACTION_EDIT);
intent.setData(Uri.parse("content://contacts/people/5" ));
startActivity(intent);

// 因此,在ANADOIR 2.0 以上的版本中的正确用法如下所示(测试成功):
Intent intent = new Intent(Intent.ACTION_EDIT);
intent.setData(ContentUris.withAppendedId(ContactsContract.Contacts.CONTENT_URI,5));
startActivity(intent);
posted @ 2012-05-08 11:12  Binary-Stream  阅读(907)  评论(1编辑  收藏  举报