Android examples for android.content:Intent
send Email via Intent
import java.io.File; import android.content.Context; import android.content.Intent; import android.net.Uri; public class Main { public static void sendEmail(Context context, String[] to, String subject, String body, String path) { Intent email = new Intent(android.content.Intent.ACTION_SEND); if (to != null) { email.putExtra(android.content.Intent.EXTRA_EMAIL, to); }//w ww . j a v a 2 s . c om if (subject != null) { email.putExtra(android.content.Intent.EXTRA_SUBJECT, subject); } if (body != null) { email.putExtra(android.content.Intent.EXTRA_TEXT, body); } if (path != null) { File file = new File(path); email.putExtra(android.content.Intent.EXTRA_STREAM, Uri.fromFile(file)); email.setType("image/png"); } context.startActivity(Intent.createChooser(email, "email")); } }