tags:

views:

85

answers:

1

Hi, When ever we need to send an email in Android we will invoke registered email application using Intent.ACTION_SEND. like the below

Intent i = new Intent(Intent.ACTION_SEND);
startActivity(Intent.createChooser(i, "Send mail..."));


My doubt is why do we need to use Intent.createChooser in startActivity rather than using startActivty(i).
Is there any specific reason of using Intent.createChooser()?
I will be waiting for help on this issue.

Thanks And Regards.

+1  A: 

The chooser enables the user to pick another mail application than the default. Its very useful if you use normal gmail (privat) and email (work related) and you want to choose which one to take.

Should be always used...

WarrenFaith
But along with mailApplication, messaging application is also poping up if I have only one mail application in my device.Then how to restrict to only one application i.e. only mail application to be launched in response to the intent
Android_programmer_camera
@Android_programmer_camera: Please allow the user to send whatever it is by whatever means they wish. Why do you feel that you need to limit the user's options?
CommonsWare
Hey,I did n't get u.Can u explain it?
Android_programmer_camera
CommonsWare just said, you shouldn't filter the options, you should let the user decide what he want to start. I strongly recommend this way!
WarrenFaith