Android的MMS意图与图片及正文意图、正文、图片、Android

由网友(覆了天下又如何)分享简介:我想创建一个意图将启动彩信软件,我附有图片文件,以及一些pre定义的文本present在邮件正文中。I am trying to create an intent that will start the MMS application for me with an image file attached and so...

我想创建一个意图将启动彩信软件,我附有图片文件,以及一些pre定义的文本present在邮件正文中。

I am trying to create an intent that will start the MMS application for me with an image file attached and some pre-defined text present in the message body.

到目前为止,我已经在同一时间能够完成一个或,但不能同时使用。

Thus far I've been able to accomplish either or, but not both at the same time.

事情我已经尝试过(他们的结果):

Things I've tried (with their results):

sendIntent = new Intent(android.content.Intent.ACTION_SEND,Uri.parse("mms://"));
sendIntent.setType("image/gif");
sendIntent.putExtra(Intent.EXTRA_STREAM, imgStreamUri);
sendIntent.putExtra("sms_body", "HelloWorld");
startActivity(Intent.createChooser(sendIntent,"Send"));    
/**********
Image file is attached but no text added to message body.
 **********/

sendIntent = new Intent(android.content.Intent.ACTION_SEND);
sendIntent.setType("image/gif");
sendIntent.putExtra(Intent.EXTRA_STREAM, imgStreamUri);
sendIntent.putExtra(Intent.EXTRA_SUBJECT, "HelloWorld");
sendIntent.putExtra(Intent.EXTRA_TITLE, "WorldHello");
startActivity(Intent.createChooser(sendIntent,"Send"));
/**********
Image file is attached but no text added to message body(or subject or anything).
 **********/

有谁知道我可以将两种主体文本和图像文件,以彩信的意图,将启动默认的消息传递应用程序填充了合适的项目?

Does anyone know how I can attach both body text and an image file to an mms intent that will launch the default messaging application with the appropriate items filled in?

编辑:经过测试,在答案中提供的code @lenik。这是工作在某些设备上,这里是我发现

Tested the code @lenik provided in answer. It is working on some devices, here's what I found

正确使用:

在4G的史诗(银河S) 史诗的4G触摸(GALAXY S II) 在Galaxy Nexus的(ICS 4.0.4) 的HTC Desire(升级Froyo 2.2) 摩托罗拉光子

图片连接,但没有文字:

Image attached but no text:

的Sidekick4克 三星变换超

任何人都知道,如果我基本上s.o.l.在设备不正常这样?

Anyone know if I am basically s.o.l. on the devices that don't work properly this way?

推荐答案

以下code对我的作品:

The following code works for me:

Intent intent = new Intent(Intent.ACTION_SEND);
intent.putExtra("sms_body", "Hi how are you");
intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File("/sdcard/file.gif")));
intent.setType("image/gif"); 
startActivity(Intent.createChooser(intent,"Send"));
阅读全文

相关推荐

最新文章