android update contact name

非 Y 不嫁゛ 提交于 2020-01-06 05:23:29

问题


I need to update a contact name but i didn't way the way to do that with the old contact api (my application must work in 1.5,1.6 AND 2.X)


回答1:


Ahan well do something like this

Intent i = new Intent(Intent.ACTION_EDIT);

i.setData(Uri.parse("content://com.android.contacts/raw_contacts/1));

//Here 1 is the id of the contact to edit. You can also generate it automatically.

startActivity(i);


If you mean at runtime you want to select id from an text box , you can do something like

Intent i = new Intent(Intent.ACTION_EDIT);

i.setData(Uri.parse("content://com.android.contacts/raw_contacts/" + textBox.getText() ));

//Here textBox should have any numerical value of the contact to edit.

startActivity(i);



来源:https://stackoverflow.com/questions/4147740/android-update-contact-name

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!