tags:

views:

86

answers:

1

Hi, I am designing an app in which i need open an email client on clicking a button. The email client should be opened with pre defined subject and 'to' address. Is there a way to attain this??? Plz provide me the solution and code if possible...

+3  A: 

Goes like this:

Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("plain/text");
intent.putExtra(Intent.EXTRA_EMAIL, new String[] { "[email protected]" });
intent.putExtra(Intent.EXTRA_SUBJECT, "subject");
intent.putExtra(Intent.EXTRA_TEXT, "mail body");
startActivity(Intent.createChooser(intent, ""));
alex
When i click the button its displaying that NO APPLCATIONS CAN PERFORM THIS ACTION.... Whats the solution???
Rahul Varma
This will only work on a real device.
alex
Is there any other way to open an email client in my emulator..????
Rahul Varma
Not that I'm aware of.
alex