1

我正在尝试使用 HTC 设备(2.3.5,HTC Desire HD-Sense)通过彩信发送 jpg 图像,我正在使用以下代码段

File sendfilepath = new File("file://" + sendfile);
Uri urimms = Uri.fromFile(sendfilepath);

Intent sendIntent = new Intent("android.intent.action.SEND_MSG");
sendIntent.putExtra(Intent.EXTRA_STREAM, urimms);
sendIntent.setType("image/jpeg");
startActivity(sendIntent);

它会打开消息应用程序,但不会附加图像。我不知道为什么?它显示吐司“无法加载消息”

4

2 回答 2

0

尝试这个

Intent sendIntent = new Intent(Intent.ACTION_SEND); 
        sendIntent.setClassName("com.android.mms", "com.android.mms.ui.ComposeMessageActivity");
        sendIntent.putExtra("sms_body", "some text"); 
        sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file:///sdcard/image_4.png"));
        sendIntent.setType("image/png");
        startActivity(sendIntent);; 
于 2013-01-07T13:10:42.500 回答
0

像这样的东西应该工作:

Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.parse("mmsto:<number>");
intent.putExtra("address", <number>);
intent.putExtra(Intent.EXTRA_STREAM, urimms);
intent.setType("image/jpeg");
startActivity(intent);

否则这些链接看起来有点过时,但您应该能够很好地翻译所有内容:

于 2012-07-23T22:36:21.883 回答