我想我的代码更新联系人详细信息(如姓名,电话号码,电子邮件,组织的详细信息等)在android通讯录中。我成功修改了一些(姓名,电话号码和电子邮件具体),但不是全部。更新Android上的联系信息
每当我试着联系人更新的组织细节(Contacts.Organizations.COMPANY和Contacts.Organizations.TITLE)我的应用程序抛出一个异常
java.lang.UnsupportedOperationException: Cannot update URL: content://contacts/people/69/organizations/69
的代码片段如下:
Uri baseUri = ContentUris.withAppendedId(People.CONTENT_URI, 69);
Uri uri = Uri.withAppendedPath(baseUri, People.Phones.CONTENT_DIRECTORY);
Cursor c = this.getContentResolver().query(uri,
new String[] { Contacts.Organizations._ID, Contacts.Organizations.COMPANY,Contacts.Organizations.TITLE},
null, null, null);
if(c.getCount() > 0) {
uri = ContentUris.withAppendedId(uri, c.getString(0));
ContentValues val1 = new ContentValues();
val1.put(Contacts.Organizations.COMPANY, "arw");
val1.put(Contacts.Organizations.TYPE, Contacts.Organizations.TYPE_WORK);
val1.put(Contacts.Organizations.TITLE, "abcdef");
this.getContentResolver().insert(uri, val1);
这不是一个问题。在任何人都可以帮忙之前,你需要解释你认为的问题,并给我们更多的信息。 – 2010-02-04 14:43:41
无论何时我尝试更新联系人的组织详细信息(Contacts.Organizations.COMPANY和Contacts.Organizations.TITLE),我的应用程序都会抛出异常java.lang.UnsupportedOperationException:无法更新URL:content:// contacts/people/69 /组织/ 69 – pankajagarwal 2010-02-05 04:33:08