0

我想设置一些东西来启动内置的联系人选择器,让用户选择电子邮件、电话号码等,然后在我的活动中获取所述地址/电话号码。

我是否正确假设这对于 android 是不可能的?在联系人有多个电话号码/电子邮件的情况下,您似乎至少必须自己建立一个对话框来选择。

即使在此之前,似乎也没有办法同时选择电话号码和电子邮件。

https://github.com/codinguser/android_contact_picker或滚动你自己的 UI 是唯一的方法吗?

4

1 回答 1

0

Its perfectly possible and straight forward with android. You don't need to create any dialog box or anything for it. Just lauch the built in contact picker Activity via an Intent.

It you have to launch the intent from some event handler

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

You should also have to implement

protected void onActivityResult(int requestCode, int resultCode, Intent data) {
}

to receive URI of the contact user picked.

Thousands of tutorials are available on INTERNET on how to do it. Google is your friend. Here is one http://mobile.tutsplus.com/tutorials/android/android-essentials-using-the-contact-picker/

于 2013-08-02T20:23:41.807 回答