0

Currently i am working in Android application, To create mail composer screen so i tried to create a mail composer screen my level best, but i didn't know, how to make this screen? please any one guide me.

Thanks in Advance

I tried this:

 Intent email = new Intent(Intent.ACTION_SEND);
    email.putExtra(Intent.EXTRA_EMAIL,new String[] { "yourid@gmail.com"});
    email.putExtra(Intent.EXTRA_SUBJECT,"Contact Us");
    email.putExtra(Intent.EXTRA_TEXT, text field here);
    email.setType("message/rfc822");
    startActivity(Intent.createChooser(email, "Choose an Email client :"));

Result:

enter image description here

SampathKumar
  • 2,525
  • 8
  • 47
  • 82

3 Answers3

2

You can use below code for the compose mail android automatically display this kind of the screen on your devices.

Intent email = new Intent(Intent.ACTION_SEND);
         email.putExtra(Intent.EXTRA_EMAIL,new String[] { "yourid@gmail.com"});
         email.putExtra(Intent.EXTRA_SUBJECT,"Contact Us");
         email.putExtra(Intent.EXTRA_TEXT, text field here);

                email.setType("message/rfc822");

                startActivity(Intent.createChooser(email, "Choose an Email client :"));

Try ! Good Luck.

Rahul Patel
  • 3,823
  • 5
  • 30
  • 46
0

I think the best way is to create a LinearLayout vertical, and insert three EditText with hint. For the third field (Compose mail), you can change the weight of the widget to fill the parent.

Don't forget to put the height of your layout to "FILL_PARENT"

Hope it'll help you.

Aerilys
  • 1,628
  • 1
  • 16
  • 22
0

Change type to "text/plain" instead of "message/rfc822" following the code snippet:

Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);                emailIntent.setType("text/plain");
email.putExtra(Intent.EXTRA_EMAIL,new String[] { "yourid@gmail.com"});
startActivity(Intent.createChooser(emailIntent, "Choose an Email client :"));

if u check this in emulator use android version 2.2 and above it works for me

Vicky
  • 285
  • 2
  • 4
  • 13