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 Intent share(final String content) {
    Intent sendIntent = new Intent();
    sendIntent.setAction(Intent.ACTION_SEND);
    sendIntent.putExtra(Intent.EXTRA_TEXT, content);
    sendIntent.setType("text/plain");
    return sendIntent;
}

From source file:Main.java

public static Intent createShareIntent(String string) {
    Intent intent = new Intent(Intent.ACTION_SEND);
    intent.setType("text/plain");
    intent.putExtra(Intent.EXTRA_TEXT, string);
    return intent;
}

From source file:Main.java

public static Intent getShareTextIntent(String content) {
    Intent intent = new Intent(Intent.ACTION_SEND);
    intent.setType("text/plain");
    intent.putExtra(Intent.EXTRA_TEXT, content);
    return intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
}

From source file:Main.java

public static Intent getShareInfoIntent(String info) {
    Intent intent = new Intent(Intent.ACTION_SEND);
    intent.setType("text/plain");
    return intent.putExtra(Intent.EXTRA_TEXT, info);
}

From source file:Main.java

public static Intent getShareHtmlIntent(String htmlText) {
    Intent textIntent = new Intent();
    textIntent.setAction(Intent.ACTION_SEND);
    textIntent.putExtra(Intent.EXTRA_TEXT, "This is html");
    textIntent.putExtra(Intent.EXTRA_HTML_TEXT, htmlText);
    textIntent.setType("text/plain");
    return textIntent;
}

From source file:Main.java

public static Intent createShareIntent(String title, String text) {
    final Intent intent = new Intent(Intent.ACTION_SEND);
    intent.setType("content/plain");
    intent.putExtra(Intent.EXTRA_TEXT, text);
    return Intent.createChooser(intent, title);
}

From source file:Main.java

public static void shareAppInfo(Context context, String info) {
    Intent intent = new Intent(Intent.ACTION_SEND);
    intent.setType("text/plain");
    intent.putExtra(Intent.EXTRA_TEXT, info);
    context.startActivity(intent);//from ww  w. j a  v  a  2s .  c  o  m
}

From source file:Main.java

public static void sendTo(Context ctx, String sendWhat) {
    Intent shareIntent = new Intent(Intent.ACTION_SEND);
    shareIntent.setType("text/plain");
    shareIntent.putExtra(Intent.EXTRA_TEXT, sendWhat);
    ctx.startActivity(shareIntent);/*  w  w  w  .  j  a v a2s  .c o m*/
}

From source file:Main.java

public static void shareText(Activity activity, String title, String text) {
    Intent sendIntent = new Intent();
    sendIntent.setAction(Intent.ACTION_SEND);
    sendIntent.putExtra(Intent.EXTRA_TEXT, text);
    sendIntent.setType("text/plain");
    activity.startActivity(Intent.createChooser(sendIntent, title));
}

From source file:Main.java

public static void share(Context context, String title, String url) {
    Intent shareIntent = new Intent(Intent.ACTION_SEND);
    shareIntent.setType("text/plain");
    shareIntent.putExtra(Intent.EXTRA_TEXT, url);
    Intent chooserIntent = Intent.createChooser(shareIntent, title);
    chooserIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(chooserIntent);
}