Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Email intent not working

I had this in my onOptionItemSelected of menu. Whenever I try to run this intent it throws force close error.

case R.id.Mail:
    Intent emailIntent=new Intent(android.content.Intent.ACTION_SEND);
    emailIntent.setType("plain/text");
    emailIntent.putExtra(android.content.Intent.EXTRA_TEXT,message);
    startActivity(emailIntent);
    break;
like image 406
Razin Avatar asked Mar 22 '13 12:03

Razin


People also ask

Is intent deprecated?

The Intent is not deprecated the problem is with your itemClickable. class because it is not recognized. Either you have somehow enabled extra warnings that identify Intent as deprecated or something is really stack at your machine.


1 Answers

it might help you..

Intent email = new Intent(Intent.ACTION_SEND);
email.putExtra(Intent.EXTRA_EMAIL, new String[]{"[email protected]"});        
email.putExtra(Intent.EXTRA_SUBJECT, "Sunject Text Here..");
email.putExtra(Intent.EXTRA_TEXT, "");
email.setType("message/rfc822");
startActivity(Intent.createChooser(email, "Send Mail Using :"));
like image 165
Ajay Avatar answered Oct 02 '22 15:10

Ajay