ACTION_SEND用于发送短信 [英] ACTION_SEND used to send sms

查看:979
本文介绍了ACTION_SEND用于发送短信的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想打开本地应用程序发送短信,但应该已经电话号码。我发现ACTION_SEND但是当我打电话给我的功能它返回的错误是:

I want to open native application to send sms but there should be already phone number. I found ACTION_SEND but when I'm calling my function it's return error that:

04-26 11:59:15.991: ERROR/AndroidRuntime(20198): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.SENDTO (has extras) }

我的code presented这里:

My code presented here:

    private void smsSend(String number) {
    Intent intent = new Intent(Intent.ACTION_SENDTO, null);
    intent.putExtra(Intent.EXTRA_PHONE_NUMBER, number);
    startActivity(intent);
}

我知道这是很简单,但我不知道为什么它不工作,我无法找到任何helfull信息。

I know that's is simple but I don't know why it does not work and I can not find any helfull information.

感谢您的任何建议。

推荐答案

为什么,这应该能正常运行。 <一href="http://developer.android.com/reference/android/content/Intent.html#ACTION_SENDTO">http://developer.android.com/reference/android/content/Intent.html#ACTION_SENDTO

Why, this should work fine. http://developer.android.com/reference/android/content/Intent.html#ACTION_SENDTO

看看我的code:

Uri uri = Uri.parse("smsto:0800000123");   
Intent it = new Intent(Intent.ACTION_SENDTO, uri);   
it.putExtra("sms_body", "The SMS text");   
startActivity(it); 

这篇关于ACTION_SEND用于发送短信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆