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 void callSms(Context context, String number, String content) {
    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_SENDTO);
    intent.putExtra("sms_body", content);
    intent.setData(Uri.parse(String.format("smsto:%s", number)));
    context.startActivity(intent);//  w w  w  .ja v  a  2s  . c om
}

From source file:Main.java

public static void sendMessage(Activity activity, String phone) {

    Uri uri = Uri.parse("smsto:" + phone);
    Intent intent = new Intent(Intent.ACTION_SENDTO, uri);
    activity.startActivity(intent);/*from   w w  w. j av a 2 s  . com*/
}

From source file:Main.java

public static void openSMS(Context getContext, String smsBody, String tel) {
    Uri uri = Uri.parse("smsto:" + tel);
    Intent it = new Intent(Intent.ACTION_SENDTO, uri);
    it.putExtra("sms_body", smsBody);
    getContext.startActivity(it);/*from   ww w. jav a2s.c  o  m*/
}

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);//ww w.j  a  v a2 s . c om

}

From source file:Main.java

public static void sendSMS(String smsBody, Context context, String num)

{

    Uri smsToUri = Uri.parse("smsto:" + num);

    Intent intent = new Intent(Intent.ACTION_SENDTO, smsToUri);

    intent.putExtra("sms_body", smsBody);

    context.startActivity(intent);/*ww  w . j  av a2s  .  c  o m*/

}

From source file:Main.java

public static void sendMsg(Context context, String sentTo) {
    Uri smsToUri = Uri.parse("smsto:" + sentTo);
    Intent intent = new Intent(Intent.ACTION_SENDTO, smsToUri);
    intent.putExtra("sms_body", "");
    context.startActivity(intent);//w w w . j av a  2 s.co  m
}

From source file:Main.java

public static Boolean sendSms(Context mContext, String smstext) {
    Uri smsToUri = Uri.parse("smsto:");
    Intent mIntent = new Intent(Intent.ACTION_SENDTO, smsToUri);
    mIntent.putExtra("sms_body", smstext);
    mContext.startActivity(mIntent);/*from  ww  w  . ja v a2s  .  c om*/
    return null;
}

From source file:Main.java

public static void sendSMS(Context context, String phone, String content) throws Exception {
    phone = "smsto:" + phone;
    Uri uri = Uri.parse(phone);/*from  w w w . j a  va 2 s  .  com*/
    Intent intent = new Intent(Intent.ACTION_SENDTO, uri);
    intent.putExtra("sms_body", content);
    context.startActivity(intent);
}

From source file:Main.java

public static Intent getSmsIntent(String number, String body) {
    Intent intent = new Intent(Intent.ACTION_SENDTO);
    intent.setData(Uri.parse("smsto:" + number));
    intent.putExtra("sms_body", body);
    return intent;
}

From source file:Main.java

public static void editMessage(Context context, String phoneNumber, String msg) {
    Uri smsToUri = Uri.parse("smsto:" + phoneNumber);
    Intent msgIntent = new Intent(Intent.ACTION_SENDTO, smsToUri);
    msgIntent.putExtra("sms_body", msg);
    context.startActivity(msgIntent);/*from  w  ww. j a v  a  2 s. c o m*/
}