Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ActivityNotFoundException trying to load Contacts ContentProvider?

This is a weird one. I am seeing this crash report on some devices:

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

The intent that generates this error is:

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

Or:

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

The device is simply reported as "Droid" but I don't know the OS version.

like image 293
sehugg Avatar asked Sep 13 '10 15:09

sehugg


1 Answers

To get a contact I use the following code:

Intent intent = new Intent ( Intent.ACTION_GET_CONTENT );
intent.setType ( ContactsContract.Contacts.CONTENT_ITEM_TYPE );
startActivityForResult ( intent, 1 );
like image 129
Andrea Carron Avatar answered Oct 19 '22 02:10

Andrea Carron