访问联系人过滤器
Android 手机上的联系人带有“过滤联系人”等设置,允许用户设置“仅显示有电话号码的联系人”和“仅显示在线联系人”等内容,以及要显示的联系人组(例如,仅电话、电话和谷歌等)。
执行此操作时,
Intent intent = new Intent(Intent.ACTION_PICK);
intent.setType(ContactsContract.Contacts.CONTENT_TYPE);
startActivityForResult(intent, PICK_CONTACT);
有什么方法可以将这些过滤器应用到联系人列表吗?默认情况下,它似乎会返回所有内容。如果不能,是否有某种方法可以访问这些设置以查看它们是什么,以便我可以构建自己的联系人选择器列表以匹配电话用户设置默认值的方式?这仅适用于 Android 2 及以上版本。
(理想的选择是调用联系人选择器的方法,让用户还可以从那里设置过滤器。)
The contacts on the android phone come with settings like "Filter Contacts" that lets the user set things like "Show only contacts that have phone numbers" and "Only show contacts that are online", and which sets of contacts to display (eg, phone only, phone and google etc.).
When doing this
Intent intent = new Intent(Intent.ACTION_PICK);
intent.setType(ContactsContract.Contacts.CONTENT_TYPE);
startActivityForResult(intent, PICK_CONTACT);
is there any way to get those filters applied to the contacts list? By default it seems to return everything. If you can't, is there some way to access those settings to see what they are, so I can build my own contacts picker list to match how the phone user has set their default? This only needs to work for Android 2 up.
(The ideal option would be a way to invoke the contact picker that lets the user also set the filters from in there.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为,如果您将 URI 传递给意图,如 此处,您应该能够应用您的过滤器。所以你会做这样的事情:
I think if you pass a URI to the intent like the one shown here, you should be able to apply your filter. So you'd do something like this: