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 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 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);
}

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 Intent getAndroidImageShareIntent(CharSequence chooseTitle, String pathfile) {
    Intent share = new Intent(Intent.ACTION_SEND);
    share.setType("image/*");
    share.putExtra(Intent.EXTRA_STREAM, Uri.parse(pathfile));
    return Intent.createChooser(share, chooseTitle);
}

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 w  w  .  j a v a2 s .  co m*/
}

From source file:Main.java

public static void forward(Context context, String body) {
    if (body != null) {
        Intent intent = new Intent(Intent.ACTION_SEND);
        intent.setType("text/plain");
        intent.putExtra(Intent.EXTRA_TEXT, body);
        context.startActivity(intent);//from  ww  w  .  j  a v a  2  s.  c  om
    }
}

From source file:Main.java

public static void sendMail(Context context, String email) {
    Intent sendIntent = new Intent();
    sendIntent.setAction(Intent.ACTION_SEND);
    sendIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { email });
    sendIntent.putExtra(Intent.EXTRA_TEXT, "");
    sendIntent.setType("text/plain");
    context.startActivity(sendIntent);/*  www . j ava  2 s  .  co m*/
}

From source file:Main.java

public static Intent getAndroidShareIntent(CharSequence chooseTitle, CharSequence subject,
        CharSequence content) {/*ww w  .  j av 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 Intent newEmailIntent(String toAddress, String subject, String body, String cc) {
    Intent intent = new Intent(Intent.ACTION_SEND);
    intent.putExtra(Intent.EXTRA_EMAIL, new String[] { toAddress });
    intent.putExtra(Intent.EXTRA_TEXT, body);
    intent.putExtra(Intent.EXTRA_SUBJECT, subject);
    intent.putExtra(Intent.EXTRA_CC, cc);
    intent.setType("message/rfc822");
    return intent;
}

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));
}