【发布时间】:2014-03-19 15:36:57
【问题描述】:
我的应用使用自定义 ContentProvider 将联系人“Bob”添加到通讯录。
在 Android 通讯录应用中,Bob 与任何其他 (Google) 联系人一样显示。但是当我在联系人应用程序中编辑 Bob 时,我的应用程序提供的数据是不可编辑的。到目前为止一切顺利。
我的问题是:在我的应用程序中,有没有办法启动通讯录应用程序,允许用户编辑 Bob 的部分属于我的应用?
我尝试使用相应的Intent,如Android guide 中所述,但使用 Bob 的 raw 联系人 uri:
Uri rawUri = getRawContactUri("Bob");
Intent intent = new Intent(Intent.ACTION_EDIT, rawUri);
startActivityForResult(intent, EDIT_CONTACT_RESULT);
这会打开通讯录应用程序,但仍然无法编辑 Bob 的数据。
有很多关于 SO 的问题涉及如何open your app from within the Contacts app when a custom field is selected 或how to fire ACTION_EDIT correctly。
但我没有找到任何声明 - 包括参考 - 如果可以使用联系人应用程序让用户编辑自定义原始联系人。有没有人有线索,最好是参考?
【问题讨论】:
标签: android android-intent android-contentprovider android-contacts