将影像附加到MMS [英] Attaching images to MMS

查看:177
本文介绍了将影像附加到MMS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图附加一个从图片库挑一个彩信图像。

I am trying to attach an image that is picked from the image gallery to a MMS.

我使用下面的code

I am using the following code

public void onActivityResult(int requestCode, int resultCode, Intent data) {

if (resultCode == RESULT_OK) {
    if (requestCode == SELECT_PICTURE) {

        Uri selectedImageUri = data.getData();
        selectedImagePath = getPath(selectedImageUri);
        Uri uri = Uri.parse(selectedImagePath);
        Intent sendIntent = new Intent(Intent.ACTION_SEND); 
        sendIntent.putExtra("sms_body", "some text"); 
        sendIntent.putExtra(Intent.EXTRA_STREAM, uri);
        sendIntent.setType("image/png"); 
        startActivity(Intent.createChooser(sendIntent, ""));
    }
}

当我选择它被重定向到MMS应用程序,但显示举杯它说对不起,你可以不重视这个图像的图像

When I select the image it is redirecting to the MMS application but displaying a toast which says Sorry you could not attach this image.

当我试图发送电子邮件没有被抛出任何错误相同的图像。这里是logcat的输出。

When I tried to email the same image there was no errors thrown. Here is the Logcat output.

01-27 16:04:26.485: ERROR/Mms/media(728): IOException caught while opening or reading stream
01-27 16:04:26.485: ERROR/Mms/media(728): java.io.FileNotFoundException: No content provider: /sdcard/6906-lightning.jpg
01-27 16:04:26.485: ERROR/Mms/media(728):     at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:507)
01-27 16:04:26.485: ERROR/Mms/media(728):     at android.content.ContentResolver.openInputStream(ContentResolver.java:345)
01-27 16:04:26.485: ERROR/Mms/media(728):     at java.lang.reflect.Method.invoke(Method.java:521)

我也想知道怎么MMS应用程序打开时插入pre定义的联系号码。

I want to also know how to insert a pre defined PhoneNumber when the MMS application is opened.

推荐答案

排序吧...

我的错误。相反URI流的我通过影像的位置。

My Mistake. Instead of uri stream i passed the image location.

通过解决它......

Solved it by using...

sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(selectedImageUri.toString()));

这篇关于将影像附加到MMS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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