Android Email Send shareViaEmail(Context context, String subject, String text)

Here you can find the source of shareViaEmail(Context context, String subject, String text)

Description

share Via Email

Declaration

public static void shareViaEmail(Context context, String subject,
            String text) 

Method Source Code

//package com.java2s;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;

public class Main {
    public static void shareViaEmail(Context context, String subject,
            String text) {//from ww w .  j a v  a2  s.c o  m
        Intent intent = new Intent(Intent.ACTION_SENDTO);
        intent.setType("text/html");
        intent.setData(Uri.parse("mailto:"));
        intent.putExtra(Intent.EXTRA_TEXT, text);
        intent.putExtra(Intent.EXTRA_SUBJECT, subject);
        context.startActivity(Intent.createChooser(intent,
                "Share via Email"));
    }
}

Related

  1. sendEmail(@Nonnull Context context, @Nullable String chooserMessage, @Nonnull String[] recipients, @Nullable String subject, @Nullable String message)
  2. sendEmail(@Nonnull Context context, @Nullable String chooserMessage, @Nullable String recipient, @Nullable String subject, @Nullable String message)
  3. sendEmail(Activity oActivity, String strTo, String strSubject, String strText)