Android的意图动作" ACTION_INSERT_OR_EDIT" - 应被用于添加联系人? [英] Android Intent Action "ACTION_INSERT_OR_EDIT" - should it be used for adding contacts?

查看:925
本文介绍了Android的意图动作" ACTION_INSERT_OR_EDIT" - 应被用于添加联系人?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前,我正在寻找将在Android的接触从SDK 7级。我看了一下默认联系人应用程序,并找到了意向(当某些类型的数据,如电话号码可用)的易和支持方式.ACTION_INSERT_OR_EDIT,这是用于添加新联系人(或添加一个数字,从接触提供商的联系人)从拨号屏幕MIME类型vnd.android.cursor.item /人。 现在,它会很高兴地知道如何找到有关应使用行动,如果它是正确的方式努力支持尽可能多的手机时,可以添加额外的一些文档。

At the moment I am searching for an easy and supported way of adding contacts in Android up from SDK level 7. (when some kind of data like the phone number is available) I looked at the default contact application and found "Intent.ACTION_INSERT_OR_EDIT" which is used for adding a new contact (or adding a number to a contact from the contact provider) from the dialer screen with the mime type "vnd.android.cursor.item/person". Now it would be nice to know how to find some documentation about the extras that should be added when using that action and if it is the correct way trying to support as much as possible handsets.

我期待着阅读你的想法。非常感谢你。

I'm looking forward reading your ideas. Thank you very much.

问候。

推荐答案

由于大部分的Andr​​oid文档的推移,原生意图的文件是pretty的纤薄,但额外提供这里列出:<一href="http://developer.android.com/reference/android/provider/ContactsContract.Intents.Insert.html">http://developer.android.com/reference/android/provider/ContactsContract.Intents.Insert.html

As much of the Android documentation goes, the documentation for native intents is pretty slim, but the available extras are listed here: http://developer.android.com/reference/android/provider/ContactsContract.Intents.Insert.html

下面是一个例子:

Intent intent = new Intent(Intent.ACTION_INSERT_OR_EDIT);
intent.setType(ContactsContract.Contacts.CONTENT_ITEM_TYPE);
intent.putExtra(ContactsContract.Intents.Insert.EMAIL, "example@example.com");
startActivity(intent);

在code以上应该开始的活动,可以让你选择要编辑的example@example.com插入一个新的电子邮件中的联系人,或者让你创建example@example.com一个新的联系人插入作为电子邮件。

The code above should start an activity that lets you pick a contact to edit with the "example@example.com" inserted as a new email, or let you create a new contact with "example@example.com" inserted as the email.

这篇关于Android的意图动作&QUOT; ACTION_INSERT_OR_EDIT&QUOT; - 应被用于添加联系人?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆