本文整理汇总了Java中android.content.Intent.ACTION_SENDTO属性的典型用法代码示例。如果您正苦于以下问题:Java Intent.ACTION_SENDTO属性的具体用法?Java Intent.ACTION_SENDTO怎么用?Java Intent.ACTION_SENDTO使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.content.Intent
的用法示例。
在下文中一共展示了Intent.ACTION_SENDTO属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onNoDoubleClick
@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;
}
}
示例2: sendMsg
/**
* 发送消息
* @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);
}
}
示例3: sendSMSFromUri
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);
}
示例4: submitOrder
/**
* 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);
}
}
开发者ID:ItalianCoder,项目名称:Google-Developer-Challenge-Scholarship-Android-Basics,代码行数:35,代码来源:MainActivity.java
示例5: onClick
/**
* 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;
}
}
示例6: getSendSmsIntent
/**
* 获取跳至发送短信界面的意图
*
* @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);
}
示例7: sendEmail
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;
}
示例8: phoneMessageByIntent
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);
}
}
示例9: feedbackToEmail
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)));
}
示例10: sendSms
/**
* 发送短信
*/
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);
}
示例11: openSendMsg
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);
}
示例12: sendSms
/**
* 短信分享
*
* @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;
}
示例13: sendEmail
/**
* Отправить 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();
}
}
}
示例14: getSendSmsIntent
/**
* 获取跳至发送短信界面的意图
*
* @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);
}
示例15: sendMMSFromUri
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);
}