我想我的代碼更新聯繫人詳細信息(如姓名,電話號碼,電子郵件,組織的詳細信息等)在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