i am trying to build a app, where phone contacts only with email address has to be displayed to the user.When the user click on the editbox in my app,phone contacts only with email address has to be displayed,after the user selects a contact, the email address of that contact has to be sent back to my app, which i use it further in my app.
//this is my code under onActivityResult() method
try
{
Uri result = data.getData();
String id = result.getLastPathSegment();
cursor = getContentResolver().query(Email.CONTENT_URI, null, Email.CONTACT_ID + "=?", new String[] { id }, null);
emailIdx = cursor.getColumnIndex(Email.DATA);
if (cursor.moveToFirst())
{
while (cursor.isAfterLast() == false)
{
emailid = cursor.getString(emailIdx);
allids.add(emailid);
cursor.moveToNext();
}
}
else
{
//no results actions
}
}
// This is the intent i am passing.
Intent intent = new Intent(Intent.ACTION_PICK,ContactsContract.Contacts.CONTENT_URI);
intent.setType(ContactsContract.CommonDataKinds.Email.ADDRESS);
startActivityForResult(intent, 1);
// manifest permissions.
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<intent-filter>
<action android:name="android.intent.action.PICK" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="vnd.android.cursor.dir/email_v2" />
<data android:mimeType="vnd.android.cursor.item/email_v2" />
</intent-filter>
i am getting the below error when i try to run my app.
android.content.ActivityNotFoundException: No Activity found to handle Intent {act=android.intent.action.PICK typ=data1 }
I am not sure of what could be the problem, am i missing something in the manifest.xml?.please help.
Thanks!