Example usage for android.content Intent ACTION_SENDTO

List of usage examples for android.content Intent ACTION_SENDTO

Introduction

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

Prototype

String ACTION_SENDTO

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

Click Source Link

Document

Activity Action: Send a message to someone specified by the data.

Usage

From source file:Main.java

public static Intent getSmsIntent(String number) {
    return new Intent(Intent.ACTION_SENDTO, Uri.parse("smsto:" + number));
}

From source file:Main.java

public static Intent createSmsToIntent(String text) {
    Intent sendIntent = new Intent(Intent.ACTION_SENDTO, Uri.parse("smsto:"));
    sendIntent.putExtra("sms_body", text);
    return sendIntent;
}

From source file:Main.java

public static Intent newSendToIntent(String emailAddress, String subject, String contentBody) {
    return new Intent(Intent.ACTION_SENDTO).setData(Uri.parse("mailto:" + Uri.encode(emailAddress) + "?subject="
            + Uri.encode(subject) + "&body=" + Uri.encode(contentBody)));
}

From source file:Main.java

public static void openEmail(Context context, String email) {
    Intent data = new Intent(Intent.ACTION_SENDTO);
    data.setData(Uri.parse(email));/*from   ww  w.ja va2s. c  om*/
    context.startActivity(data);
}

From source file:Main.java

public static void sendEmail(Context context, String receiver) {
    Intent intent = new Intent(Intent.ACTION_SENDTO);
    intent.setData(Uri.parse("mailto:" + receiver));
    context.startActivity(intent);/*w ww.  j  a v  a 2s. co m*/
}

From source file:Main.java

public static void shareViaEmail(Context context, String subject, String text) {
    Intent intent = new Intent(Intent.ACTION_SENDTO);
    intent.setType("text/html");
    intent.setData(Uri.parse("mailto:"));
    intent.putExtra(Intent.EXTRA_TEXT, text);
    intent.putExtra(Intent.EXTRA_SUBJECT, subject);
    context.startActivity(Intent.createChooser(intent, "Share via Email"));
}

From source file:Main.java

public static void openSendMsg(Context context) {
    Uri uri = Uri.parse("smsto:");
    Intent intent = new Intent(Intent.ACTION_SENDTO, uri);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent);//from w  w w .j  av  a  2  s  .  c om
}

From source file:Main.java

public static void openSendMsg(Context getContext) {
    Uri uri = Uri.parse("smsto:");
    Intent intent = new Intent(Intent.ACTION_SENDTO, uri);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    getContext.startActivity(intent);//from   w  w  w  .  ja  v  a2s .co m
}

From source file:Main.java

public static Intent getSendSmsIntent(String phoneNumber, String content) {
    Uri uri = Uri.parse("smsto:" + phoneNumber);
    Intent intent = new Intent(Intent.ACTION_SENDTO, uri);
    intent.putExtra("sms_body", content);
    return intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
}

From source file:Main.java

public static Intent newEmailIntent(String toAddress, String subject, String body, String cc) {
    Intent intent = new Intent(Intent.ACTION_SENDTO);
    intent.setData(Uri.parse("mailto:" + Uri.encode(toAddress) + "?subject=" + Uri.encode(subject) + "&body="
            + Uri.encode(body) + "&cc=" + Uri.encode(cc)));
    return intent;
}