Example usage for android.content Intent EXTRA_TEXT

List of usage examples for android.content Intent EXTRA_TEXT

Introduction

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

Prototype

String EXTRA_TEXT

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

Click Source Link

Document

A constant CharSequence that is associated with the Intent, used with #ACTION_SEND to supply the literal data to be sent.

Usage

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);//from  w ww . j av  a 2  s  .  c o  m
}

From source file:Main.java

public static void shareApkInfo(String info, Context context) {
    Intent intent = new Intent();
    intent.setAction("android.intent.action.SEND");
    intent.addCategory("android.intent.category.DEFAULT");
    intent.setType("text/plain");
    intent.putExtra(Intent.EXTRA_TEXT, info);
    context.startActivity(intent);/*ww  w.j a v a 2 s.  c om*/
}

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 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);//  w  ww.ja v  a 2s. c  om
}

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 Intent getAndroidShareIntent(CharSequence chooseTitle, CharSequence subject,
        CharSequence content) {/*  w  w w.  j a  va2  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 startShareIntentActivity(Activity activity, String text) {
    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_SEND);
    intent.addCategory(Intent.CATEGORY_DEFAULT);
    intent.setType("text/plain");
    intent.putExtra(Intent.EXTRA_TEXT, text);
    activity.startActivity(intent);/*from w ww  .j a v  a2  s . co 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 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  www  .  j a v  a2s  .  c o m*/

}

From source file:Main.java

/**
 * Share App/*from   w w  w  .  j  av a  2  s.  com*/
 *
 * @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"));
}