简体   繁体   English

使用什么代替Contacts.Intents.UI.LIST_STARRED_ACTION在com.android.contacts中显示已加星标的联系人?

[英]What to use instead of Contacts.Intents.UI.LIST_STARRED_ACTION to display starred contacts in com.android.contacts?

Currently, I use this: 目前,我使用这个:

startActivity(new Intent(Contacts.Intents.UI.LIST_STARRED_ACTION));

Works perfectly, but Android Studio displays: 完美运行,但Android Studio显示:

'LIST_STARRED_ACTION' is deprecated as of API 5: Android 2.0 (Eclair) 从API 5开始不推荐使用“ LIST_STARRED_ACTION”:Android 2.0(Eclair)

How to implement the same functionality (opening com.android.contacts displaying the starred contacts) without using deprecated code? 如何在不使用不推荐使用的代码的情况下实现相同的功能(打开显示加星标的联系人的com.android.contacts)?

You can try this: new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI) It open contact book to pick contact. 您可以尝试以下操作: new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI)它打开通讯录以选择联系人。 you can use startActivityForResult() or startActivity() 您可以使用startActivityForResult()startActivity()

NB It is only show whole contact list. 注意:仅显示整个联系人列表。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM