My app adds contact 'Bob' to the address book using a custom ContentProvider
.
In the Android Contacts app, Bob shows up just as any other (Google) contact. But when I edit Bob in the Contacts app, the data provided by my application is not editable. So far so good.
My question is: From within my app, is there a way to fire up the Contacts app, in a way that allows the user to edit the portion of Bob that belongs to my app?
I have tried to use the corresponding Intent
, as described in this Android guide, but using the raw contact uri for Bob:
Uri rawUri = getRawContactUri("Bob");
Intent intent = new Intent(Intent.ACTION_EDIT, rawUri);
startActivityForResult(intent, EDIT_CONTACT_RESULT);
which brings up the Contacts app, but still without the possibility to edit Bob's data.
There are plenty of questions on SO covering how to open your app from within the Contacts app when a custom field is selected or how to fire ACTION_EDIT
correctly.
But I did not find any statement - including a reference - if it is possible to use Contacts app to let the user edit custom raw contacts. Does anyone have a clue and preferably a reference?
You need to add EditSchema to your contact.xml file and add meta-data, pointing to that file in SyncService section of your manifest file, like this:
Here is example of EditSchema in official sources: http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android-apps/4.2.2_r1/packages/apps/Contacts/tests/res/xml/test_basic_contacts.xml/