Invalid email intent

I had it on the menu onOptionItemSelected. Whenever I try to run this intention, it causes a force 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;
+5
source share
4 answers

it can help you.

Intent email = new Intent(Intent.ACTION_SEND);
email.putExtra(Intent.EXTRA_EMAIL, new String[]{"abc@gmail.com"});        
email.putExtra(Intent.EXTRA_SUBJECT, "Sunject Text Here..");
email.putExtra(Intent.EXTRA_TEXT, "");
email.setType("message/rfc822");
startActivity(Intent.createChooser(email, "Send Mail Using :"));
+7
source

try using it like that

        Intent intent = new Intent(); 
    intent.setAction(android.content.Intent.ACTION_SEND); 
    intent.setType("plain/text");
    intent.putExtra(android.content.Intent.EXTRA_EMAIL,  new String[]{address});
    return intent;
0
source

. , , Android. .

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;
0

.   emailIntent.setType( "/" );

-1

All Articles