Example usage for android.content Intent EXTRA_SUBJECT

List of usage examples for android.content Intent EXTRA_SUBJECT

Introduction

In this page you can find the example usage for android.content Intent EXTRA_SUBJECT.

Prototype

String EXTRA_SUBJECT

To view the source code for android.content Intent EXTRA_SUBJECT.

Click Source Link

Document

A constant string holding the desired subject line of a message.

Usage

From source file:Main.java

static Intent makeShareIntent(String subject, String text) {
    final Intent intent = new Intent(Intent.ACTION_SEND);
    intent.setType("text/plain");
    intent.putExtra(Intent.EXTRA_SUBJECT, subject);
    intent.putExtra(Intent.EXTRA_TEXT, text);
    return intent;
}

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);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent);// Intent.createChooser(intent, title)
}

From source file:Main.java

public static void sendStringByMail(Context c, String string) {
    final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
    emailIntent.setType("plain/text");
    emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "DROIDSHEEP DEBUG INFORMATION");
    emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, string);
    c.startActivity(Intent.createChooser(emailIntent, "Send mail..."));
}

From source file:Main.java

public static void showSentEmailIntent(Context context, String subject, String body) {
    Intent emailIntent = new Intent(Intent.ACTION_SEND);
    emailIntent.setType("message/rfc822");
    emailIntent.putExtra(Intent.EXTRA_SUBJECT, subject);
    emailIntent.putExtra(Intent.EXTRA_TEXT, body);
    context.startActivity(emailIntent);/*w ww . java2  s . com*/
}

From source file:Main.java

public static void shareToOtherApp(Context context, String title, String content, String dialogTitle) {
    Intent intentItem = new Intent(Intent.ACTION_SEND);
    intentItem.setType("text/plain");
    intentItem.putExtra(Intent.EXTRA_SUBJECT, title);
    intentItem.putExtra(Intent.EXTRA_TEXT, content);
    intentItem.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(Intent.createChooser(intentItem, dialogTitle));
}

From source file:Main.java

public static Intent getAndroidShareIntent(CharSequence chooseTitle, CharSequence subject,
        CharSequence content) {/*  w  w w .  j  a  v a  2  s .c  o  m*/
    Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND);
    shareIntent.setType("text/plain");
    shareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject);
    shareIntent.putExtra(android.content.Intent.EXTRA_TEXT, content);
    return Intent.createChooser(shareIntent, chooseTitle);
}

From source file:Main.java

public static void shareViaIntent(Context context, String subject, String extraText) {
    Intent sendIntent = new Intent();
    sendIntent.setType("text/plain");
    sendIntent.setAction(Intent.ACTION_SEND);
    sendIntent.putExtra(Intent.EXTRA_SUBJECT, subject);
    sendIntent.putExtra(Intent.EXTRA_TEXT, extraText);
    context.startActivity(sendIntent);/*from w  w w .  j  a  v  a  2  s . c  o  m*/
}

From source file:Main.java

public static void shareContent(Context context, String subject, String summary, String url) {

    Intent intent = new Intent(android.content.Intent.ACTION_SEND);
    intent.setType("text/plain");
    intent.putExtra(Intent.EXTRA_SUBJECT, subject);
    intent.putExtra(Intent.EXTRA_TEXT, url);
    context.startActivity(Intent.createChooser(intent, "Share"));

}

From source file:Main.java

public static void shareFile(Context context, String title, String subject, String text, String mime,
        String path) {/*from  ww w.j  av a2s . com*/
    Intent sendIntent = new Intent(Intent.ACTION_SEND);
    sendIntent.setType(mime);
    sendIntent.putExtra(Intent.EXTRA_SUBJECT, subject);
    sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://" + path));
    sendIntent.putExtra(Intent.EXTRA_TEXT, text);
    context.startActivity(Intent.createChooser(sendIntent, title));
}

From source file:Main.java

public static void mail(Activity activity, String subject, String text, String mail) {

    Intent intent = new Intent();

    intent.setAction(Intent.ACTION_SENDTO);
    intent.setData(Uri.parse("mailto:" + mail));
    intent.putExtra(Intent.EXTRA_SUBJECT, subject);
    intent.putExtra(Intent.EXTRA_TEXT, text);

    activity.startActivity(intent);//from w w  w . j ava 2  s.  c o m

}