本文介绍了我如何获得startActivityForResult(),调出电话联系只是一个列表(就像当我点击"人"图标)使用Android SDK的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

原谅我,如果这个问题是显而易见的,但我是新来的Andr​​oid SDK中。

excuse me if this question is obvious, but I am new to android sdk.

我所试图做的就是有真正的电话号码发送短信的联系人列表。我直接部署到我的手机,并尝试使用刚刚在我的手机上市的接触,但我得到了太多怪异的接触。我希望,当我打电话startActivityForResult()方法,它会给我的手机联系人列表。什么,似乎做的是给我的所有可能的联系人列表,而且似乎包括推特,脸谱,和每一个潜在的电子邮件地址,我已经派人来,而不是仅仅列出当我点击人物联系人图标我的手机。在code我使用调用它是在这里:

What I am trying to do is get a list of contacts that have real telephone numbers to send an sms message. I am deploying directly to my phone and trying to use just the contacts listed on my phone, but I am getting too many weird contacts. I would expect that when I call the startActivityForResult() method it will give me a list of phone contacts. What it seems to do is give me a list of all potential contacts and that seems to include twitter, facebook, and every potential email address I have sent to instead of just the contacts that are listed when I click on the "People" icon on my phone. The code I am using to call it is here:

private static final int PICK_CONTACT_REQUEST = 1;//defined elsewhere but listed for clarity

Intent intent = new Intent(Intent.ACTION_PICK, Contacts.CONTENT_URI);
startActivityForResult(intent, PICK_CONTACT_REQUEST);

在弹出的列表中数百个无名接触(多用,看起来是微博图片图标照片)开始了,而且还包括什么似乎是刚刚电子邮件联系人,其中包括似乎是每一个Craigslist的电子邮件,我也许曾经送到。任何人都清楚这件事给我吗?我怎么得到的只是人物名单没有所有的其他联系人数据?

The list that pops up starts off with hundreds of "Unnamed" contacts (many with icon photos that look to be twitter images), but also include what appear to be just email contacts, including what seems to be every craigslist email I may have ever sent to. Can anybody clear this up for me? how do I get just the "People" list without all the additional contact data?

推荐答案

有几个predifined与标准应用触点操作。

There are several predifined actions with standard application contacts.

我想,你要找的是什么:

I think, what you're looking for is :

intent = new Intent(android.provider.Contacts.Intents.UI.LIST_CONTACTS_WITH_PHONES_ACTION);

更新:嗯,这似乎去$ P $现在pcated,从API 5日起,应该使用的。我不知道这个API虽然。

Update: well this seems deprecated now, starting from API 5, one should use ContactsContract. I do not know this API though.

这篇关于我如何获得startActivityForResult(),调出电话联系只是一个列表(就像当我点击"人"图标)使用Android SDK的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-02 00:30