android - ActivityNotFoundException 试图加载联系人 ContentProvider?

标签 android android-intent

这很奇怪。我在某些设备上看到了这个崩溃报告:

android.content.ActivityNotFoundException:
   No Activity found to handle Intent {
     act=android.intent.action.PICK dat=content://com.android.contacts/contacts }

产生这个错误的 Intent 是:

Intent intent = new Intent(Intent.ACTION_PICK, People.CONTENT_URI); // pre-Eclair

或者:

Intent intent = new Intent(Intent.ACTION_PICK, Contacts.CONTENT_URI); // post-Eclair

该设备被简单地报告为“Droid”,但我不知道操作系统版本。

最佳答案

要获取联系人,我使用以下代码:

Intent intent = new Intent ( Intent.ACTION_GET_CONTENT );
intent.setType ( ContactsContract.Contacts.CONTENT_ITEM_TYPE );
startActivityForResult ( intent, 1 );

关于android - ActivityNotFoundException 试图加载联系人 ContentProvider?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3701966/

相关文章:

java - 在 xml 中显示整数值的代码是什么?

java - 在 Android 中创建同步 HTTP GET 请求

android - 如何更改 Android Studio 中的 minSdk 版本?

android - 从 Monkeyrunner 传递带有 Parcelable 对象的 Bundle

android - 如何显示和处理应用程序的联系方式 Intent ?

java - 通过单击 Android 上 Twitter 应用程序中的推文来打开应用程序

android - Java,scala 和 android studio 中的 gradle 插件

android - React Native ERROR Packager 无法监听端口 8081

android - 将 Google play 作为新应用程序打开

android - 另一个包中的新 Activity 杀死了我的应用程序