Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android - Opening the email application?

I want to open the email application on my android app: The following code crashes Am I doing anything wrong? please provide code

Intent i = new Intent (Intent.ACTION_SEND,Uri.fromParts("mailto", "[email protected]", null)); this.startActivity(i); 
like image 379
aryaxt Avatar asked Mar 16 '11 23:03

aryaxt


People also ask

How do I open email on Android?

Go to Settings > Add account > Other. Enter your full email address, such as [email protected] and then tap Manual Setup. Choose Personal (IMAP) or Personal (POP3). Enter your password and tap Next.

How do I open my email app?

From the Home screen, tap the Apps icon (in the QuickTap bar) > the Apps tab (if necessary) > Email or tap the Email icon directly from the Home screen. The first time you open the Email app, a setup wizard opens to help you add an email account.

What is the email app on Android called?

Gmail works beautifully with Android, and it's completely free. It is also integrated with other Google services, which work well on Android devices and is simple to add multiple Gmail accounts to one device.


2 Answers

/* Create the Intent */ final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);  /* Fill it with Data */ emailIntent.setType("plain/text"); emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]{"[email protected]"}); emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Subject"); emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Text");  /* Send it off to the Activity-Chooser */ context.startActivity(Intent.createChooser(emailIntent, "Send mail...")); 

Try this, it is a bit more clear. Nonetheless intent for emails only works if you are using the application in a real phone, so if you are using the emulator, try it on a real phone.

like image 80
dLobatog Avatar answered Oct 21 '22 09:10

dLobatog


Try This :

    Intent intent = new Intent(Intent.ACTION_VIEW);     Uri data = Uri.parse("mailto:"             + "[email protected]"             + "?subject=" + "Feedback" + "&body=" + "");     intent.setData(data);     startActivity(intent); 
like image 25
tilak Avatar answered Oct 21 '22 09:10

tilak