Java Code Examples for android.content.Intent.ACTION_SENDTO

The following are Jave code examples for showing how to use ACTION_SENDTO of the android.content.Intent class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: ClouldReader   File: NavDeedBackActivity.java   View Source Code Vote up 7 votes
@Override
protected void onNoDoubleClick(View v) {
    switch (v.getId()) {
        case R.id.tv_issues:
            WebViewActivity.loadUrl(v.getContext(),CommonUtils.getString(R.string.string_url_issues),"Issues");
            break;
        case R.id.tv_qq:
            String url = "mqqwpa://im/chat?chat_type=wpa&uin=544351900";
            startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
            break;
        case R.id.tv_email:
            Intent data = new Intent(Intent.ACTION_SENDTO);
            data.setData(Uri.parse("[email protected]"));
            startActivity(data);
            break;
        case R.id.tv_jianshu:
            WebViewActivity.loadUrl(v.getContext(),"http://www.crazyjoe.cn","加载中...");
            break;
        case R.id.tv_faq:
            WebViewActivity.loadUrl(v.getContext(),string_url_faq,"常见问题归纳");
            break;
    }
}
 
Example 2
Project: GitHub   File: ContactDetailPage.java   View Source Code Vote up 6 votes
/**
 * 发送消息
 * @param String phone
 */
private void sendMsg(String phone){
	Uri smsToUri = Uri.parse("smsto:" + phone);
	Intent intent = new Intent(Intent.ACTION_SENDTO, smsToUri);
	int resId = ResHelper.getStringRes(activity, "smssdk_invite_content");
	if (resId > 0) {
		intent.putExtra("sms_body", activity.getString(resId));
	}
	if (intent.resolveActivity(this.getContext().getPackageManager()) != null) {
		startActivity(intent);
	}
}
 
Example 3
Project: tvConnect_android   File: ResultHandler.java   View Source Code Vote up 6 votes
final void sendSMSFromUri(String uri, String body) {
  Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.parse(uri));
  putExtra(intent, "sms_body", body);
  // Exit the app once the SMS is sent
  intent.putExtra("compose_mode", true);
  launchIntent(intent);
}
 
Example 4
Project: Google-Developer-Challenge-Scholarship-Android-Basics   File: MainActivity.java   View Source Code Vote up 6 votes
/**
 * This method is called when the order button is clicked.
 */
public void submitOrder(View view) {
    // Get user's name
    EditText nameField = (EditText) findViewById(R.id.name_field);
    Editable nameEditable = nameField.getText();
    String name = nameEditable.toString();

    // Figure out if the user wants whipped cream topping
    CheckBox whippedCreamCheckBox = (CheckBox) findViewById(R.id.whipped_cream_checkbox);
    boolean hasWhippedCream = whippedCreamCheckBox.isChecked();

    // Figure out if the user wants choclate topping
    CheckBox chocolateCheckBox = (CheckBox) findViewById(R.id.chocolate_checkbox);
    boolean hasChocolate = chocolateCheckBox.isChecked();

    // Calculate the price
    int price = calculatePrice(hasWhippedCream, hasChocolate);

    // Display the order summary on the screen
    String message = createOrderSummary(name, price, hasWhippedCream, hasChocolate);

    // Use an intent to launch an email app.
    // Send the order summary in the email body.
    Intent intent = new Intent(Intent.ACTION_SENDTO);
    intent.setData(Uri.parse("mailto:")); // only email apps should handle this
    intent.putExtra(Intent.EXTRA_SUBJECT,
            getString(R.string.order_summary_email_subject, name));
    intent.putExtra(Intent.EXTRA_TEXT, message);

    if (intent.resolveActivity(getPackageManager()) != null) {
        startActivity(intent);
    }
}
 
Example 5
Project: Android-2017   File: MainActivity.java   View Source Code Vote up 6 votes
/**
 * Gestiona el evento en los botones click
 *
 * @param view vista que origina l'event
 */
@Override
public void onClick(View view) {
    Hashtable<String, String> params;
    // procesamos el evento en función del origen del evento.
    switch (view.getId()) {
        case R.id.btnBrowser:
            openIntent(Intent.ACTION_VIEW, "http://www.google.com");
            break;
        case R.id.btnTexto:
            params = new Hashtable<>();
            params.put(Intent.EXTRA_TEXT, getString(R.string.textoEjemplo));
            openIntent(Intent.ACTION_SEND, "text/plain", params);
            break;
        case R.id.btnLLamada:
            openIntent(Intent.ACTION_DIAL, "tel:5551234");
            break;
        case R.id.btnEmail:
            Intent intent = new Intent(Intent.ACTION_SENDTO);
            intent.setType("text/plain");
            intent.setData(Uri.parse("mailto:[email protected]"));
            intent.putExtra(Intent.EXTRA_SUBJECT, "asunto de prueba");
            intent.putExtra(Intent.EXTRA_TEXT, "probando el envio");
            intent.putExtra(Intent.EXTRA_EMAIL, new String[]{"[email protected]"});
            startActivity(intent);
            break;
        case R.id.btnFoto:
            getPicture();
            break;
    }
}
 
Example 6
Project: AndroidUtilCode-master   File: IntentUtils.java   View Source Code Vote up 6 votes
/**
 * 获取跳至发送短信界面的意图
 *
 * @param phoneNumber 接收号码
 * @param content     短信内容
 */
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);
}
 
Example 7
Project: MaterialAbout   File: IntentUtil.java   View Source Code Vote up 6 votes
public Intent sendEmail (String email, String subject, String message) {
	Intent intent = new Intent(Intent.ACTION_SENDTO);
	intent.setData(Uri.parse("mailto:")); // only email apps should handle this
	intent.putExtra(Intent.EXTRA_EMAIL, new String[]{email});
	intent.putExtra(Intent.EXTRA_SUBJECT, subject);
	intent.putExtra(Intent.EXTRA_TEXT, message);
	
	return intent;
}
 
Example 8
Project: MyCalendar   File: FunctionHelper.java   View Source Code Vote up 6 votes
public static void phoneMessageByIntent(Activity activity, String phone_number) {
    Intent sendIntent = new Intent(Intent.ACTION_SENDTO);
    sendIntent.setData(Uri.parse("smsto:" + phone_number));
    if (sendIntent.resolveActivity(activity.getPackageManager()) != null) {
        activity.startActivity(sendIntent);
    }
}
 
Example 9
Project: StopApp   File: AboutActivity.java   View Source Code Vote up 6 votes
private void feedbackToEmail() {
    Intent data = new Intent(Intent.ACTION_SENDTO);
    data.setData(Uri.parse("mailto:[email protected]"));
    data.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.send_email_subject));
    data.putExtra(Intent.EXTRA_TEXT, "----------\n" + getString(R.string.send_email_app_name) + getString(R.string.app_name)
            + getString(R.string.send_email_app_version) + CommonUtil.getAppVersion(AboutActivity.this)
            + getString(R.string.send_email_phone_model) + CommonUtil.getPhoneModel()
            + getString(R.string.android_version) + CommonUtil.getAndroidVersion()
            + "\n----------"
            + getString(R.string.leave_feedback));
    startActivity(Intent.createChooser(data, getString(R.string.choose_email_app)));
}
 
Example 10
Project: AndroidCollection   File: PhoneUtils.java   View Source Code Vote up 6 votes
/**
 * 发送短信
 */
public static void sendSms(Context context, String phoneNumber, String content) {
    Uri uri = Uri.parse("smsto:" + (TextUtils.isEmpty(phoneNumber) ? "" : phoneNumber));
    Intent intent = new Intent(Intent.ACTION_SENDTO, uri);
    intent.putExtra("sms_body", TextUtils.isEmpty(content) ? "" : content);
    context.startActivity(intent);
}
 
Example 11
Project: android-project-gallery   File: TDevice.java   View Source Code Vote up 6 votes
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);
}
 
Example 12
Project: rongyunDemo   File: CommonUtils.java   View Source Code Vote up 6 votes
/**
 * 短信分享
 *
 * @param mContext
 * @param smstext 短信分享内容
 * @return
 */
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);
    return null;
}
 
Example 13
Project: utils-android   File: IntentUtils.java   View Source Code Vote up 6 votes
/**
 * Отправить email
 *
 * @param context   контекст
 * @param addresses адреса эл. почты отправителей
 * @param subject   тема письма
 * @param text      текст
 */
public static void sendEmail(@Nullable Context context,
                             @Nullable String[] addresses,
                             @Nullable String subject,
                             @Nullable CharSequence text) {
    if (context != null) {
        Intent intent = new Intent(Intent.ACTION_SENDTO);
        intent.setData(Uri.parse("mailto:")); // only email apps should handle this
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

        if (addresses != null && addresses.length > 0) {
            intent.putExtra(Intent.EXTRA_EMAIL, addresses);
        }
        if (!TextUtils.isEmpty(subject)) {
            intent.putExtra(Intent.EXTRA_SUBJECT, subject);
        }
        if (!TextUtils.isEmpty(text)) {
            intent.putExtra(Intent.EXTRA_TEXT, text);
        }
        if (intent.resolveActivity(context.getPackageManager()) != null) {
            context.startActivity(intent);
        } else {
            Toast.makeText(context, R.string.error_dont_have_email_app, Toast.LENGTH_SHORT)
                    .show();
        }
    }
}
 
Example 14
Project: LJFramework   File: IntentUtils.java   View Source Code Vote up 6 votes
/**
 * 获取跳至发送短信界面的意图
 *
 * @param phoneNumber 接收号码
 * @param content 短信内容
 */
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);
}
 
Example 15
Project: weex-3d-map   File: ResultHandler.java   View Source Code Vote up 6 votes
final void sendMMSFromUri(String uri, String subject, String body) {
  Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.parse(uri));
  // The Messaging app needs to see a valid subject or else it will treat this an an SMS.
  if (subject == null || subject.isEmpty()) {
    putExtra(intent, "subject", activity.getString(R.string.msg_default_mms_subject));
  } else {
    putExtra(intent, "subject", subject);
  }
  putExtra(intent, "sms_body", body);
  intent.putExtra("compose_mode", true);
  launchIntent(intent);
}
 
Example 16
Project: PrivacyShield   File: HomeActivity.java   View Source Code Vote up 6 votes
private void selectOptionFromNav(int position){


        switch(position) {
            case 0:

                startActivity(new Intent(this,AboutActivity.class));
                break;
            case 1:
                Intent intent = new Intent(Intent.ACTION_SENDTO);
                String uriText = "mailto:" + Uri.encode("[email protected]") + "?subject=" + Uri.encode("Reporting A Bug/Feedback") + "&body=" + Uri.encode("Hello, \nI want to report a bug/give feedback corresponding to the app FileCrypt App.\n.....\n\n-Your name");
                Uri uri = Uri.parse(uriText);
                intent.setData(uri);
                startActivity(Intent.createChooser(intent, "Send Email"));
                break;
            case 2:
                startActivity(new Intent(this,SettingsActivity.class));
                break;
            case 3:
                startActivity(new Intent(this,TeamActivity.class));
                break;
            case 4:
                AlertDialog.Builder alertDialog = new AlertDialog.Builder(this);
                alertDialog.setTitle("Contact Us");
                alertDialog.setMessage("\nReach us at : \n\n\nContact No. : 9461308222 \n\n\nEmail Id : [email protected]\n\n");
                alertDialog.setIcon(android.R.drawable.sym_contact_card);
                alertDialog.show();
                break;

        }


        mDrawerList.setItemChecked(position, true);
        setTitle(titles[position]);
        mDrawerLayout.closeDrawer(mDrawerList);
    }
 
Example 17
Project: MoligyMvpArms   File: DeviceUtils.java   View Source Code Vote up 5 votes
public static void openSMS(Context context, String smsBody, String tel) {
    Uri uri = Uri.parse("smsto:" + tel);
    Intent it = new Intent(Intent.ACTION_SENDTO, uri);
    it.putExtra("sms_body", smsBody);
    context.startActivity(it);
}
 
Example 18
Project: ForeverLibrary   File: PhoneUtil.java   View Source Code Vote up 5 votes
/**
 * 调起系统发短信功能
 */
public static void doSendSMSTo(String message, Activity activity) {
    Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.parse("smsto:"));
    intent.putExtra("sms_body", message);
    activity.startActivity(intent);
}
 
Example 19
Project: Companion-For-PUBG-Android   File: DrawerActivity.java   View Source Code Vote up 5 votes
private void contactUsSelected() {
    final Intent emailIntent = new Intent(Intent.ACTION_SENDTO,
                                          Uri.fromParts("mailto", Constants.CONTACT_US_EMAIL, null));
    startActivity(Intent.createChooser(emailIntent, getString(R.string.label_send_email)));
}
 
Example 20
Project: MVPArmsTest1   File: DeviceUtils.java   View Source Code Vote up 5 votes
public static void openSMS(Context context, String smsBody, String tel) {
    Uri uri = Uri.parse("smsto:" + tel);
    Intent it = new Intent(Intent.ACTION_SENDTO, uri);
    it.putExtra("sms_body", smsBody);
    context.startActivity(it);
}