Status Update
Comments
ja...@google.com <ja...@google.com> #2
ma...@bokhorst.biz <ma...@bokhorst.biz> #3
Hence closing this issue.
ma...@bokhorst.biz <ma...@bokhorst.biz> #4
Let select the right attachment ;-)
ja...@google.com <ja...@google.com> #5
ej...@google.com <ej...@google.com> #6
In most cases it isn't necessary to resolve the intent, and you could instead catch the exception in the event that no app is available. For example:
Intent pick = new Intent(Intent.ACTION_PICK, ContactsContract.CommonDataKinds.Email.CONTENT_URI);
try {
startActivityForResult(pick, REQUEST_CODE);
} catch (ActivityNotFoundException e) {
Snackbar.make(view, R.string.title_no_contacts, Snackbar.LENGTH_LONG).show();
}
If for whatever reason you do need to resolve/query apps that can handle this intent, then you can declare the corresponding <intent>
element. In this case this would be:
<intent>
<action android:name="android.intent.action.PICK" />
<data android:scheme="content"
android:host="com.android.contacts"
android:mimeType="vnd.android.cursor.dir/email_v2" />
</intent>
Or more succinctly (since a content URI is assumed when only a mime-type is specified):
<intent>
<action android:name="android.intent.action.PICK" />
<data android:mimeType="vnd.android.cursor.dir/email_v2" />
</intent>
Specifying the mime-type explicitly is important, since the <intent>
won't match the expected <intent-filter>
elements without it (we'll update our documentation to make this clearer). The mime-type can be found in the documentation:
Alternatively, you can find the mime-type for an arbitrary URI via adb:
$ adb shell content gettype --uri content://com.android.contacts/data/emails
Result: vnd.android.cursor.dir/email_v2
lb...@gmail.com <lb...@gmail.com> #7
Not to mention that the docs don't explain it.
Please offer something to make migrations easier.
Description
Return null