【问题标题】:Can not update contact using ContentProvoider无法使用 ContentProvoider 更新联系人
【发布时间】:2011-05-11 07:24:07
【问题描述】:
Uri name=null;
           String []whereargs={"Sameer Ahmad"};
    name=Uri.withAppendedPath(People.CONTENT_URI,People.Phones.CONTENT_DIRECTORY);
    cv1.put(People.NAME,"Tofeeq Ahmad");
    int i1=0;
    i1=getContentResolver().update(name,cv1,"name=?",whereargs);
    }
    catch(Exception e){
        e.getMessage();

我正在尝试通过 URi 更新电话号码,但它在插入时显示 Exception:Cannot Update//Contacts/people/phone.Same 错误。

  1. 我想创建可从每个应用程序访问的共享数据库

【问题讨论】:

    标签: android android-contacts android-contentprovider


    【解决方案1】:

    您是否在清单中声明了必要的权限?

    <uses-permission android:name="android.permission.WRITE_CONTACTS" />
    

    【讨论】:

    • Yes..Mark 我已经声明了许可
    • 确切的例外是...... java.lang.UnsupportedOperationException: 无法更新 URL: content://contacts/people/phones
    • 请将包括堆栈跟踪在内的完整异常发布到您的初始问题中。
    • 它看起来像 stackoverflow.com/questions/2200436/… 的副本
    • 不,这是不同的。你能告诉我为什么会出现这个异常吗?我已经发布了插入的完整代码
    猜你喜欢
    • 1970-01-01
    • 2016-06-06
    • 2012-11-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-01-25
    • 1970-01-01
    相关资源
    最近更新 更多