Example usage for android.content Intent ACTION_SEND

List of usage examples for android.content Intent ACTION_SEND

Introduction

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

Prototype

String ACTION_SEND

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

Click Source Link

Document

Activity Action: Deliver some data to someone else.

Usage

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 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

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 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 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 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);//www .j  a  va2  s .  c  o m
}

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 w  ww  .  jav a2 s .  co  m*/
}

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 getShareImageIntent(Uri uri) {
    Intent image = new Intent();
    image.setAction(Intent.ACTION_SEND);
    image.putExtra(Intent.EXTRA_STREAM, uri);
    image.setType("image/*");
    return image;
}