为应用选择联系人 [英] Select contact for app

查看:212
本文介绍了为应用选择联系人的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我碰到了这个帖子:如何调用Android的联系人列表

不幸的是我读它的古老和Android 2.0的改变是如何工作的,但这个职位未能链接到实现这一新方法。谷歌也似乎缺乏任何结果,或者我不是寻找正确的事情。我想为用户能够在我的应用程序选择联系人......我怎么给他们一个提示来选择1的用户,那么选择该用户时要执行的任务。

Unfortunately I'm reading that it's old and Android 2.0 changed how this works, but this post fails to link to a new method of accomplishing this. Google also appears to either lack results, or I'm not searching for the right thing. I'd like for a user to be able to select a contact on my app... how do I give them a prompt to select 1 user, then for a task to be executed when that user is selected.

推荐答案

您需要使用 StartActivityForResult 你的联系人选择意向,然后你会得到的结果回来的时候用户选择的联系人。 这里是pretty好例如:

You need to use StartActivityForResult on your contact picker Intent and then you will get the result back when the user selects the contact. Here is a pretty good example

 Intent contactPickerIntent = new Intent(Intent.ACTION_PICK,  
        Contacts.CONTENT_URI);  
startActivityForResult(contactPickerIntent, CONTACT_PICKER_RESULT);

这篇关于为应用选择联系人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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