Java tutorial
//package com.java2s; import android.app.Activity; import android.content.Intent; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import java.util.List; public class Main { public static void mail(Activity activity, String email, String subject, String content) { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_EMAIL, new String[] { email }); intent.putExtra(Intent.EXTRA_SUBJECT, subject); if (content != null) { intent.putExtra(Intent.EXTRA_TEXT, content); } final PackageManager manager = activity.getPackageManager(); final List<ResolveInfo> matches = manager.queryIntentActivities(intent, 0); for (ResolveInfo info : matches) { if (info.activityInfo.packageName.endsWith(".gm") || info.activityInfo.name.toLowerCase().contains("gmail")) { intent.setClassName(info.activityInfo.packageName, info.activityInfo.name); } else if (info.activityInfo.packageName.endsWith(".email") || info.activityInfo.name.toLowerCase().contains("email")) { intent.setClassName(info.activityInfo.packageName, info.activityInfo.name); } } activity.startActivity(intent); } }