开发者

Can not update contact using ContentProvoider

开发者 https://www.devze.com 2023-03-04 05:22 出处:网络
Uri name=null; String []whereargs={\"Sameer Ahmad\"}; name=Uri.withAppendedPath(People.CONTENT_URI,People.Phones.CONTENT_DIRECTORY);
Uri name=null;
           String []whereargs={"Sameer Ahmad"};
    name=Uri.withAppendedPath(People.CONTENT_URI,People.Phones.CONTENT_DIRECTORY);
    cv1.put(People.NAME,"Tofeeq Ahma开发者_如何学God");
    int i1=0;
    i1=getContentResolver().update(name,cv1,"name=?",whereargs);
    }
    catch(Exception e){
        e.getMessage();

I am trying to update a phone numder by URi but its showing the Exception:Cannot Update//Contacts/people/phone.Same error in inserting.

  1. I want to create shared data base which will be accessible from every application


have you declared the necessary permission in your manifest?

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

精彩评论

暂无评论...
验证码 换一张
取 消