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 editMessage(Context context, String msg) {
    Intent msgIntent = new Intent();
    msgIntent.setAction(Intent.ACTION_SENDTO);
    msgIntent.putExtra("sms_body", msg);
    context.startActivity(msgIntent);//from w w w .  j  a v  a 2  s  . c o m
}

From source file:Main.java

/**
 * @brief      Get the intent to invoke sending email.
 *
 * @par        Sync (or) Async://from  www  . ja v a 2s .  com
 * This is a Synchronous function.
 *
 * @param [IN] email    Email address.\n
 * 
 * @return     
 *
 * @author     daiping.zhao
 * @since      1.0.0.0
 * @version    1.0.0.0
 * @par        Prospective Clients:
 * External Classes
 */
public static Intent doEmail(String email) {
    Uri uri = Uri.parse("mailto:" + email);
    return new Intent(Intent.ACTION_SENDTO, uri);
}

From source file:Main.java

public static void sendFeedback(Context context, String to, String subject, String body) {
    StringBuilder builder = new StringBuilder("mailto:" + Uri.encode(to));
    if (subject != null) {
        builder.append("?subject=" + Uri.encode(Uri.encode(subject)));
        if (body != null) {
            builder.append("&body=" + Uri.encode(Uri.encode(body)));
        }/* ww  w.  jav  a2s.co m*/
    }
    String uri = builder.toString();
    Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.parse(uri));
    context.startActivity(intent);
}

From source file:Main.java

/**
 * @brief      Get the intent to invoke sending sms.
 *
 * @par        Sync (or) Async:/*w ww.ja  v a2 s. co  m*/
 * This is a Synchronous function.
 *
 * @param [IN] telNumber    Telephone number.\n
 * 
 * @return     
 *
 * @author     daiping.zhao
 * @since      1.0.0.0
 * @version    1.0.0.0
 * @par        Prospective Clients:
 * External Classes
 */
public static Intent doSendSms(String telNumber) {
    Uri uri = Uri.parse("smsto:" + telNumber);
    return new Intent(Intent.ACTION_SENDTO, uri);
}

From source file:Main.java

public static Intent getEmailIntent(String toEmailAdr, String subject, String message, File attachmentFile,
        String intentChooserTitle) {
    String uriText = "mailto:" + toEmailAdr + "?subject=" + Uri.encode(subject) + "&body="
            + Uri.encode(message);/*from www . j  a  v  a  2  s  . c  o m*/
    Uri uri = Uri.parse(uriText);

    Intent sendIntent = new Intent(Intent.ACTION_SENDTO);
    sendIntent.setData(uri);
    if (attachmentFile != null)
        sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(attachmentFile));
    return Intent.createChooser(sendIntent, intentChooserTitle);
}

From source file:Main.java

public static Boolean sendSms(Context mContext, String smstext) {
    Uri smsToUri = Uri.parse("smsto:");
    Intent mIntent = new Intent(android.content.Intent.ACTION_SENDTO, smsToUri);
    mIntent.putExtra("sms_body", smstext);
    mContext.startActivity(mIntent);/*from   w w  w  . ja v a 2  s  . c o  m*/
    return null;
}

From source file:Main.java

public static void sendSMS(Context cxt, String smsBody) {
    Uri smsToUri = Uri.parse("smsto:");
    Intent intent = new Intent(Intent.ACTION_SENDTO, smsToUri);
    intent.putExtra("sms_body", smsBody);
    cxt.startActivity(intent);/*from  w  ww.  j  a  v  a2 s  .c o  m*/
}

From source file:Main.java

public static void sendMail(Context mContext, String mailID) {
    Uri uri = Uri.parse("mailto:" + mailID);
    mContext.startActivity(new Intent(Intent.ACTION_SENDTO, uri));
}

From source file:Main.java

public static void ShowSoftInfoDialog(final Context context, String title, String msg) {
    AlertDialog alertDialog = new AlertDialog.Builder(context).setIcon(android.R.attr.alertDialogIcon)
            .setTitle(title).setMessage(msg).setPositiveButton("ok", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int whichButton) {

                    /* User clicked OK so do some stuff */
                }//from w w  w.j a v a 2 s  .  c  o m
            }).setNeutralButton("Email", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int whichButton) {
                    Uri uri = Uri.parse("mailto:atgczcl@163.com");
                    Intent emailIntent = new Intent(Intent.ACTION_SENDTO, uri);
                    context.startActivity(emailIntent);
                    /* User clicked Something so do some stuff */
                }
            }).create();
    alertDialog.show();

}

From source file:Main.java

public static void email(Context context, String to, String subject, String body) {
    Intent send = new Intent(Intent.ACTION_SENDTO);
    String uriText = "mailto:" + Uri.encode(to) + "?subject=" + Uri.encode(subject) + "&body="
            + Uri.encode(body);//from w w w  .  java 2 s.co  m
    Uri uri = Uri.parse(uriText);

    send.setData(uri);
    context.startActivity(Intent.createChooser(send, "E-Mail senden"));
}