您好,我正在尝试通过彩信从 sdcard 发送图像(png)。我正在使用 ACTION_SEND 意图,但它似乎不起作用。
Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.putExtra("sms_body", "Sent using Spootur");
sendIntent.setType("image/png");
sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(imagePath));
startActivityForResult(sendIntent, SEND_ACTIVITY);
我知道 imagePath 的值为 /mnt/sdcard/Spootur/Pictures/6799abd6-df22-4017-89e1-d9e529790fd8.png,它指向一个现有文件。
选择菜单出现时,我选择我的消息传递应用程序(处理程序),但它给了我一个“抱歉,您无法将此图片添加到您的消息”错误。我尝试使用其他应用程序,我得到的压倒性结果是我给它的资源是“不受支持的文件类型”。我不知道为什么会发生这种情况,因为我明确地将 MIME 类型设置为 .png 图像。
有任何想法吗?以下是有问题的各种应用程序的一些 logcat 日志:
电子邮件:
05-10 00:29:35.752: W/ActivityManager(343): Trying to launch com.android.email/.activity.MessageCompose
05-10 00:29:35.962: I/Database(24487): sqlite returned: error code = 0, msg = Recovered 12 frames from WAL file /data/data/com.android.email/databases/webview.db-wal
05-10 00:29:35.972: I/Database(24487): sqlite returned: error code = 0, msg = Recovered 26 frames from WAL file /data/data/com.android.email/databases/webviewCache.db-wal
05-10 00:29:36.072: W/System.err(24487): at com.android.email.activity.MessageCompose.addAttachment(MessageCompose.java:6886)
05-10 00:29:36.072: W/System.err(24487): at com.android.email.activity.MessageCompose.addAttachment(MessageCompose.java:6750)
05-10 00:29:36.072: W/System.err(24487): at com.android.email.activity.MessageCompose.addAttachment(MessageCompose.java:7112)
05-10 00:29:36.072: W/System.err(24487): at com.android.email.activity.MessageCompose.initFromIntent(MessageCompose.java:9160)
05-10 00:29:36.072: W/System.err(24487): at com.android.email.activity.MessageCompose.onCreate(MessageCompose.java:854)
05-10 00:29:36.102: W/System.err(24487): at com.android.email.Email.startServiceIfNeed(Email.java:659)
05-10 00:29:36.102: W/System.err(24487): at com.android.email.Email.isServiceConnected(Email.java:723)
05-10 00:29:36.102: W/System.err(24487): at com.android.email.Email.callWhenServiceConnected(Email.java:791)
05-10 00:29:36.102: W/System.err(24487): at com.android.email.Email.registerListener(Email.java:883)
05-10 00:29:36.102: W/System.err(24487): at com.android.email.Email.registerListener(Email.java:879)
05-10 00:29:36.102: W/System.err(24487): at com.android.email.combined.SevenUtils.addListener(SevenUtils.java:35)
05-10 00:29:36.112: W/System.err(24487): at com.android.email.Controller.addSevenListener(Controller.java:283)
05-10 00:29:36.112: W/System.err(24487): at com.android.email.Controller.addResultCallback(Controller.java:275)
05-10 00:29:36.112: W/System.err(24487): at com.android.email.activity.MessageCompose.onResume(MessageCompose.java:2457)
05-10 00:29:36.112: W/System.err(24487): at com.android.email.Email.startServiceIfNeed(Email.java:659)
05-10 00:29:36.112: W/System.err(24487): at com.android.email.Email.callWhenServiceConnected(Email.java:797)
05-10 00:29:36.112: W/System.err(24487): at com.android.email.Email.registerListener(Email.java:883)
05-10 00:29:36.112: W/System.err(24487): at com.android.email.Email.registerListener(Email.java:879)
05-10 00:29:36.112: W/System.err(24487): at com.android.email.combined.SevenUtils.addListener(SevenUtils.java:35)
05-10 00:29:36.112: W/System.err(24487): at com.android.email.Controller.addSevenListener(Controller.java:283)
05-10 00:29:36.112: W/System.err(24487): at com.android.email.Controller.addResultCallback(Controller.java:275)
05-10 00:29:36.112: W/System.err(24487): at com.android.email.activity.MessageCompose.onResume(MessageCompose.java:2457)
05-10 00:29:36.132: D/InputTransport(343): Input channel constructed: name='40710c08 com.android.email/com.android.email.activity.MessageCompose (server)', ashmemFd=288, receivePipeFd=336, sendPipeFd=328
05-10 00:29:36.132: D/InputTransport(343): Input channel constructed: name='40710c08 com.android.email/com.android.email.activity.MessageCompose (client)', ashmemFd=290, receivePipeFd=320, sendPipeFd=337
05-10 00:29:36.132: D/InputTransport(343): Input channel destroyed: name='40710c08 com.android.email/com.android.email.activity.MessageCompose (client)', ashmemFd=290, receivePipeFd=320, sendPipeFd=337
05-10 00:29:36.132: D/InputTransport(24487): Input channel constructed: name='40710c08 com.android.email/com.android.email.activity.MessageCompose (client)', ashmemFd=74, receivePipeFd=75, sendPipeFd=76
05-10 00:29:36.243: I/WindowManager(343): CREATE SURFACE Surface(name=com.android.email/com.android.email.activity.MessageCompose, identity=1887, mNativeSurface=0) IN SESSION android.view.SurfaceSession@40a3fc10: pid=24487 format=-1 flags=0x0 / Window{40710c08 com.android.email/com.android.email.activity.MessageCompose paused=false}
05-10 00:29:36.353: I/ActivityManager(343): Displayed com.android.email/.activity.MessageCompose: +604ms
消息:
05-10 00:28:18.887: D/Mms/ConversationComposer(24350): [main][end] initComposeMessage ------
05-10 00:28:18.917: V/Mms/ConversationComposer(24350): [main]getComposeMessageStatus(),state=0
05-10 00:28:18.917: V/Mms/ComposeMessage(24350): [main]initMessageList()
05-10 00:28:18.987: V/Mms/ComposeMessage(24350): [main]loadMessageContent()
05-10 00:28:19.007: W/System.err(24350): at com.android.mms.ui.MessageUtils.isAnimatedImage(MessageUtils.java:2265)
05-10 00:28:19.007: W/System.err(24350): at com.android.mms.data.WorkingMessage.setAttachment(WorkingMessage.java:601)
05-10 00:28:19.007: W/System.err(24350): at com.android.mms.ui.ComposeMessage.addImage(ComposeMessage.java:6756)
05-10 00:28:19.007: W/System.err(24350): at com.android.mms.ui.ComposeMessage.addMedia(ComposeMessage.java:6894)
05-10 00:28:19.007: W/System.err(24350): at com.android.mms.ui.ComposeMessage.addMedia(ComposeMessage.java:6961)
05-10 00:28:19.007: W/System.err(24350): at com.android.mms.ui.ComposeMessage.access$7500(ComposeMessage.java:198)
05-10 00:28:19.007: W/System.err(24350): at com.android.mms.ui.ComposeMessage$45.run(ComposeMessage.java:4680)
05-10 00:28:19.007: E/Mms/media(24350): at com.android.mms.data.WorkingMessage.changeMedia(WorkingMessage.java:2202)
05-10 00:28:19.007: E/Mms/media(24350): at com.android.mms.data.WorkingMessage.setAttachment(WorkingMessage.java:658)
05-10 00:28:19.007: E/Mms/media(24350): at com.android.mms.ui.ComposeMessage.addImage(ComposeMessage.java:6756)
05-10 00:28:19.007: E/Mms/media(24350): at com.android.mms.ui.ComposeMessage.addMedia(ComposeMessage.java:6894)
05-10 00:28:19.007: E/Mms/media(24350): at com.android.mms.ui.ComposeMessage.addMedia(ComposeMessage.java:6961)
05-10 00:28:19.007: E/Mms/media(24350): at com.android.mms.ui.ComposeMessage.access$7500(ComposeMessage.java:198)
05-10 00:28:19.007: E/Mms/media(24350): at com.android.mms.ui.ComposeMessage$45.run(ComposeMessage.java:4680)