List of usage examples for android.content Intent EXTRA_SUBJECT
String EXTRA_SUBJECT
To view the source code for android.content Intent EXTRA_SUBJECT.
Click Source Link
From source file:Main.java
/** * Share App// w ww . j a v a 2 s . c om * * @param context */ public static void shareApp(Context context) { Intent intent = new Intent(android.content.Intent.ACTION_SEND); intent.setType("text/plain"); String title = "Share NavigationFastFrame"; String extraText = "NavigationFastFrame is a very good Frame."; intent.putExtra(Intent.EXTRA_TEXT, extraText); //Share text. intent.putExtra(Intent.EXTRA_SUBJECT, title); context.startActivity(Intent.createChooser(intent, "Share this")); }
From source file:Main.java
public static void sendEmail(Context context, String receiver, String subject, String body) { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("message/rfc822"); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | IntentCompat.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); intent.putExtra(Intent.EXTRA_EMAIL, new String[] { receiver }); intent.putExtra(Intent.EXTRA_SUBJECT, subject); try {/*from w ww .j a v a 2 s . com*/ context.startActivity(Intent.createChooser(intent, "Send mail...")); } catch (android.content.ActivityNotFoundException ex) { } }
From source file:Main.java
@NonNull public static Intent sendEmail(@NonNull String[] to, @NonNull String subject, @NonNull String body, @Nullable List<Uri> attachments) { final Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE); intent.setType("message/rfc822"); intent.putExtra(Intent.EXTRA_EMAIL, to); intent.putExtra(Intent.EXTRA_SUBJECT, subject); intent.putExtra(Intent.EXTRA_TEXT, body); if (attachments != null && !attachments.isEmpty()) { intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, new ArrayList<Parcelable>(attachments)); }/* w ww . j a v a 2 s . c o m*/ return intent; }
From source file:Main.java
public static void sendMail(Context context, String[] mail, String subject, String body) { Intent i = new Intent(Intent.ACTION_SEND); i.setType("message/rfc822"); // i.putExtra(Intent.EXTRA_EMAIL , new String[]{"recipient@example.com"}); // i.putExtra(Intent.EXTRA_SUBJECT, "subject of email"); // i.putExtra(Intent.EXTRA_TEXT , "body of email"); i.putExtra(Intent.EXTRA_EMAIL, mail); i.putExtra(Intent.EXTRA_SUBJECT, subject); i.putExtra(Intent.EXTRA_TEXT, body); try {//ww w . j a va2 s. c o m context.startActivity(Intent.createChooser(i, "Send mail...")); } catch (android.content.ActivityNotFoundException ex) { Toast.makeText(context, "There are no email clients installed.", Toast.LENGTH_SHORT).show(); } }
From source file:Main.java
@NonNull public static Intent sendEmail(@NonNull String[] to, @NonNull String subject, @NonNull String body, @Nullable List<Uri> attachments) { final Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE); intent.setType("message/rfc822"); intent.putExtra(Intent.EXTRA_EMAIL, to); intent.putExtra(Intent.EXTRA_SUBJECT, subject); final ArrayList<CharSequence> extraText = new ArrayList<>(1); extraText.add(body);/*from w w w . j av a 2s. co m*/ intent.putCharSequenceArrayListExtra(Intent.EXTRA_TEXT, extraText); if (attachments != null && !attachments.isEmpty()) { intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, new ArrayList<Parcelable>(attachments)); } return intent; }
From source file:Main.java
/** * Send an email via available mail activity * /*w w w .j av a 2 s . co m*/ * @param context the app context * @param to the email address send to * @param subject the email subject * @param body the email body */ public static void sendEmail(Context context, String to, String subject, String body) { Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts("mailto", to, null)); emailIntent.putExtra(Intent.EXTRA_SUBJECT, subject); emailIntent.putExtra(Intent.EXTRA_TEXT, body); context.startActivity(Intent.createChooser(emailIntent, null)); }
From source file:Main.java
public static void shareText(Context context, String title, String text) { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_SUBJECT, title); intent.putExtra(Intent.EXTRA_TEXT, text); context.startActivity(Intent.createChooser(intent, title)); }
From source file:Main.java
public static Intent sendEmail(String[] to, String subject, String body) { final Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("message/rfc822"); intent.putExtra(Intent.EXTRA_EMAIL, to); intent.putExtra(Intent.EXTRA_SUBJECT, subject); intent.putExtra(Intent.EXTRA_TEXT, body); return intent; }
From source file:Main.java
public static Intent sendEmail(String[] to, String subject, String body) { final Intent intent = new Intent(Intent.ACTION_SEND, Uri.parse("mailto:")); intent.putExtra(Intent.EXTRA_EMAIL, to); intent.putExtra(Intent.EXTRA_SUBJECT, subject); intent.putExtra(Intent.EXTRA_TEXT, body); return intent; }
From source file:Main.java
/** * Easily create email intent/*from w w w . j a v a 2 s . c o m*/ * * @param recipientsList * @param ccList * @param subject * @param htmlBody * @return email intent chooser */ public static Intent createEmailIntent(List<String> recipientsList, List<String> ccList, String subject, CharSequence htmlBody) { Intent emailIntent = new Intent(Intent.ACTION_SENDTO); // emailIntent.setData(Uri.parse("mailto:")); if (recipientsList != null) { for (String email : recipientsList) { emailIntent.putExtra(Intent.EXTRA_EMAIL, email); } } if (ccList != null) { for (String email : ccList) { emailIntent.putExtra(Intent.EXTRA_EMAIL, email); } } if (subject != null) emailIntent.putExtra(Intent.EXTRA_SUBJECT, subject); if (htmlBody != null) emailIntent.putExtra(Intent.EXTRA_TEXT, htmlBody); return emailIntent; }