我想去捡从联系人列表中的电子邮件。 采摘的接触是不够的,因为一个联系人可以有多个电子邮件。
使用API的演示,我成功地选择一个联系人,电话号码,甚至一个地址。例如:
意向意图=新的意图(Intent.ACTION_GET_CONTENT);
intent.setType(ContactsContract.Contacts.CONTENT_ITEM_TYPE);
// 要么
intent.setType(ContactsContract.CommonDataKinds.Phone.CONTENT_ITEM_TYPE);
// 要么
intent.setType(ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE);
但试图选择一个电子邮件时
intent.setType(ContactsContract.CommonDataKinds.Email.CONTENT_ITEM_TYPE);
我收到没有找到活动异常。
在如何从所有联系人的邮件挑一个电子邮件任何想法?
感谢。 阿利克。
更新(2011年5月2日): 找到另一种方式来挑选的接触,但事情依旧电子邮件拾取未注册的意图。
工作
新意图(Intent.ACTION_PICK,ContactsContract.Contacts.CONTENT_URI);
新的意图(Intent.ACTION_PICK,ContactsContract.CommonDataKinds.Phone.CONTENT_URI);
新的意图(Intent.ACTION_PICK,ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_URI);
不工作:
新意图(Intent.ACTION_PICK,ContactsContract.CommonDataKinds.Email.CONTENT_URI);
解决方案
您必须使用下列常数(不CONTENT_ITEM_TYPE):
intent.setType(ContactsContract.CommonDataKinds.Email.CONTENT_TYPE);
I'd like to pick an email from the contacts list. Picking a contact is not good enough, because a contact can have several emails.
Using the API demo, I managed to pick a contact, phone number and even an address. Example:
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType(ContactsContract.Contacts.CONTENT_ITEM_TYPE);
// OR
intent.setType(ContactsContract.CommonDataKinds.Phone.CONTENT_ITEM_TYPE);
// OR
intent.setType(ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE);
BUT, when trying to pick an email
intent.setType(ContactsContract.CommonDataKinds.Email.CONTENT_ITEM_TYPE);
I get activity not found exception.
Any idea on how to pick an email from the all the contacts' emails?
Thanks. Alik.
Update (2011/05/02): Found another way to pick things from the contacts but still the email picker is not registered to the intent.
Working:
new Intent(Intent.ACTION_PICK,ContactsContract.Contacts.CONTENT_URI);
new Intent(Intent.ACTION_PICK,ContactsContract.CommonDataKinds.Phone.CONTENT_URI);
new Intent(Intent.ACTION_PICK,ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_URI);
NOT working:
new Intent(Intent.ACTION_PICK, ContactsContract.CommonDataKinds.Email.CONTENT_URI);
解决方案
you have to use the following constant (not CONTENT_ITEM_TYPE):
intent.setType(ContactsContract.CommonDataKinds.Email.CONTENT_TYPE);
上一篇:简单的方法来保存在LinkedList的Android应用程序?方法来、应用程序、存在、简单
下一篇:WebBrowserTask为Windows Phone 8.1Windows、WebBrowserTask、Phone