What is the purpose of using Intent.createChooser() in StartActivity() while sending email in Android -
Whenever we need to send an email to Android, we use the registered e-mail using Intent.ACTION_SEND as below. Mail application will invoke
intent = new intent (Intent.ACTION_SEND); StartActivity (Intent.createChooser (i, "Send Mail ..."));
I suspect that we need to use Intent.createChooser in startActivity instead of using startActivty (i)
? Intent.createChooser ()
?
There is no specific reason to use AFAIK if you have intent. If you use
, then there are three different types:
-
You can specify the title of the selector dialog to make it more clear.
-
The system will always display the selector dialog, which has also chosen the user default.
-
If your intent
Intent.createChooser
does not match any activity, the system will still see a dialog with the specified title and an error MessageNo application can perform this action
. Or for general intention, you may get an Android Runtime error:By: Android Contact Activity Noout Expansion: No activity was found to control intents.
Comments
Post a Comment