I have an image on my sdcard and I want to send this via email or message. Here is my code:
Intent intent = new Intent(Intent.ACTION_SEND); intent.addCategory(Intent.CATEGORY_DEFAULT); intent.setType("image/*"); intent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file:/sdcard/mydir/ myimage.jpg")); startActivity(intent); This works fine for email but gives an exception when I choose Messaging. Can someone please suggest the problem and a workaround. Here is the exception: Caused by: java.lang.IllegalArgumentException: Query on file:/sdcard/ mydir/myimage.jpg returns null result. at com.android.mms.ui.UriImage.<init>(UriImage.java:65) at com.android.mms.model.ImageModel.initModelFromUri (ImageModel.java:75) at com.android.mms.model.ImageModel.<init>(ImageModel.java:57) at com.android.mms.ui.AttachmentEditor.changeImage (AttachmentEditor.java:323) at com.android.mms.ui.ComposeMessageActivity.addImage (ComposeMessageActivity.java:2269) at com.android.mms.ui.ComposeMessageActivity.handleSendIntent (ComposeMessageActivity.java:2314) at com.android.mms.ui.ComposeMessageActivity.onCreate (ComposeMessageActivity.java:1531) at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1122) at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2104) ... 11 more Gaurav Software Developer http://SilkenMermaid.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---