start Email Intent : Email « Network « Android






start Email Intent

 
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;

class UIHelper {

  public static void startEmailIntent(final Context ctx, 
      final String emailto, 
      final String subject,
      final String text) {
    final Intent i = new Intent(Intent.ACTION_SEND);
    i.setType("text/html");

    if (emailto != null)
      i.putExtra(Intent.EXTRA_EMAIL, new String[]{emailto});

    i.putExtra(Intent.EXTRA_SUBJECT, subject);

    i.putExtra(Intent.EXTRA_TEXT, text);
    ctx.startActivity(Intent.createChooser(i, "Select email application"));
  }
}

   
  








Related examples in the same category

1.Email vis Intent
2.Builds a list of the recipients email addresses each on a different line
3.Is string an Email address
4.Send email
5.isValidEmailAddress: Check the email address is Valid
6.Launch the email intent
7.start Html Email Intent