以彩信形式发送图片
我正在研究如何从我的应用程序在 android 中发送彩信。
我将名为 image1.png 的图像复制到文件资源管理器中的 sdcard 文件夹中。它位于mnt--> SD卡--> image1.png
我运行模拟器并扫描媒体,我可以在图库中找到该图像。
现在要发送彩信,我使用了以下代码
........................................ ………………………………
Intent pic = new Intent(Intent.ACTION_SEND);
pic.putExtra("sms_body", "click the above image");
String url = "\\sdcard\\image1.png";
pic.putExtra(Intent.EXTRA_STREAM, Uri.parse(url));
pic.setType("image/png");
startActivity(pic);
...................................................... 带有 SD卡
的模拟器已经在运行,现在当我运行应用程序时,它会打开带有 TO 的彩信应用程序字段以及提到的短信正文,但未附加图像。我在屏幕上收到以下 toast 消息
................................. ...................................................... .......
“抱歉,您无法将此图片添加到您的消息中”
................................ ...................................................... ?
任何人都可以帮我解决这个问题吗
我不明白uri的概念。有人可以帮我吗?
非常感谢
I am working on how to send a MMS in android from my app.
i copied an image named image1.png to the sdcard folder in file explorer. its is located in mnt--> sdcard--> image1.png
i run the emulator and scanned the media and i can find the image in the gallery.
now to send the mms i used the following code
...................................................................................
Intent pic = new Intent(Intent.ACTION_SEND);
pic.putExtra("sms_body", "click the above image");
String url = "\\sdcard\\image1.png";
pic.putExtra(Intent.EXTRA_STREAM, Uri.parse(url));
pic.setType("image/png");
startActivity(pic);
...................................................................................
the emulator with the sdcard is already running and now when i run the application it opens up the mms apllication with a TO field and also with the sms body mentioned but the image is not attached.i get the following toast message on my screen
...................................................................................
"sorry you cannot add this picture to your message "
...................................................................................
can anyone help me with this issue?
and i dont understand the concept of uri. can someone help me out.
Many thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将代码更改为
所以实际上您需要预先附加“file://”
Change your code to
So actually you need to pre-append the "file://"