Send An Email In Android Selecting Only Email Apps And Specifying Attachment Mime Type
Solution 1:
Cross-posting my answer from the android-developer Google Group:
If you are willing to roll your own dialog, you could:
Step #1: Create the message/rfc822
Intent
, as if you were going to
send that way, and use it with PackageManager
and
queryIntentActivities()
to find out who handles it.
Step #2: Create the image/png
Intent
, as if you were going to send
that way, and use it with PackageManager
and queryIntentActivities()
to find out who handles it.
Step #3: Compute the intersection of those two sets of activities.
Step #4: Use those to populate an AlertDialog
for the user to choose from.
- Step #4a: If the intersection has one match, skip this step.
- Step #4b: If the intersection has zero matches, let the user know you can't send the message.
Step #5: Modify the image/png
Intent
to add the component selected
from the dialog, and call startActivity()
on it.
By specifying the component in the Intent
, it will go to that
particular activity. This is effectively what the regular chooser
does.
Post a Comment for "Send An Email In Android Selecting Only Email Apps And Specifying Attachment Mime Type"