Did you ever figure this out? On Jun 17, 6:27 am, mickael le trocquer <letrocquermickael-...@yahoo.com> wrote: > Hello, > I have a problem in my application. I have to send MMS with audio > attachement. > > If I do : > > public void sendMMS(Context aContext, String aFilePath) { > Intent intent = new Intent("android.intent.action.SEND_MSG"); > > intent.putExtra("address", "aphonenumber"); > intent.putExtra("sms_body", "mybody"); > > Uri uri = Uri.fromFile(new File("/sdcard/myimage.jpg")); > intent.putExtra(Intent.EXTRA_STREAM, uri); // imageUri set > previously > intent.setType("image/jpeg"); > > aContext.startActivity(intent); > > } > > It's work great. I can preview my MMS with an image in attachement. > > But if I put audio file in attachement : > > public void sendMMS(Context aContext, String aFilePath) { > Intent intent = new Intent("android.intent.action.SEND_MSG"); > > intent.putExtra("address", "aphonenumber"); > intent.putExtra("sms_body", "mybody"); > Uri uri = Uri.fromFile(new File("/sdcard/audiofile.amr")); > intent.putExtra(Intent.EXTRA_STREAM, uri); // imageUri set > previously > intent.setType("audio/amr"); > > aContext.startActivity(intent); > > } > > It's didn't work... > > I have a nice exception : > > 06-17 11:29:44.608: DEBUG/ComposeMessageActivity(3881): > initActivityState: null, Intent { act=android.intent.action.SEND_MSG > typ=audio/amr cmp=com.android.mms/.ui.ComposeMessageActivity (has > extras) } > 06-17 11:29:44.648: VERBOSE/MmsProvider(139): Delete uri=content://mms/ > 9223372036854775807/part, match=11 > 06-17 11:29:44.738: DEBUG/dalvikvm(3881): GC freed 1436 objects / > 118040 bytes in 80ms > 06-17 11:29:44.848: VERBOSE/MessageTextEditor(3881): Nli: -1 > 06-17 11:29:44.858: DEBUG/Jerry(3881): new mMessageBodyEditor > 06-17 11:29:44.978: VERBOSE/ComposeMessageActivity(3881): onCreate(): > savedInstanceState = null > 06-17 11:29:44.978: VERBOSE/ComposeMessageActivity(3881): onCreate(): > intent = Intent { act=android.intent.action.SEND_MSG typ=audio/amr > cmp=com.android.mms/.ui.ComposeMessageActivity (has extras) } > 06-17 11:29:44.978: VERBOSE/ComposeMessageActivity(3881): onCreate(): > mThreadId = 0 > 06-17 11:29:44.978: VERBOSE/ComposeMessageActivity(3881): onCreate(): > mMessageUri = null > 06-17 11:29:44.978: DEBUG/ComposeMessageActivity(3881): initFocus: > true > 06-17 11:29:45.008: DEBUG/ComposeMessageActivity(3881): > -----------------mMessageUri:null > > 06-17 11:29:45.218: ERROR/AndroidRuntime(3881): > java.lang.RuntimeException: Unable to start activity > ComponentInfo{com.android.mms/ > com.android.mms.ui.ComposeMessageActivity}: > java.lang.NullPointerException > 06-17 11:29:45.218: ERROR/AndroidRuntime(3881): at > android.app.ActivityThread.performLaunchActivity(ActivityThread.java: > 2464) > 06-17 11:29:45.218: ERROR/AndroidRuntime(3881): at > android.app.ActivityThread.handleLaunchActivity(ActivityThread.java: > 2486) > 06-17 11:29:45.218: ERROR/AndroidRuntime(3881): at > android.app.ActivityThread.access$2100(ActivityThread.java:123) > 06-17 11:29:45.218: ERROR/AndroidRuntime(3881): at > android.app.ActivityThread$H.handleMessage(ActivityThread.java:1843) > 06-17 11:29:45.218: ERROR/AndroidRuntime(3881): at > android.os.Handler.dispatchMessage(Handler.java:99) > 06-17 11:29:45.218: ERROR/AndroidRuntime(3881): at > android.os.Looper.loop(Looper.java:123) > 06-17 11:29:45.218: ERROR/AndroidRuntime(3881): at > android.app.ActivityThread.main(ActivityThread.java:4321) > 06-17 11:29:45.218: ERROR/AndroidRuntime(3881): at > java.lang.reflect.Method.invokeNative(Native Method) > 06-17 11:29:45.218: ERROR/AndroidRuntime(3881): at > java.lang.reflect.Method.invoke(Method.java:521) > 06-17 11:29:45.218: ERROR/AndroidRuntime(3881): at > com.android.internal.os.ZygoteInit > $MethodAndArgsCaller.run(ZygoteInit.java:791) > 06-17 11:29:45.218: ERROR/AndroidRuntime(3881): at > com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549) > 06-17 11:29:45.218: ERROR/AndroidRuntime(3881): at > dalvik.system.NativeStart.main(Native Method) > 06-17 11:29:45.218: ERROR/AndroidRuntime(3881): Caused by: > java.lang.NullPointerException > 06-17 11:29:45.218: ERROR/AndroidRuntime(3881): at > android.content.ContentResolver.acquireProvider(ContentResolver.java: > 574) > 06-17 11:29:45.218: ERROR/AndroidRuntime(3881): at > android.content.ContentResolver.query(ContentResolver.java:147) > 06-17 11:29:45.218: ERROR/AndroidRuntime(3881): at > com.google.android.mms.util.SqliteWrapper.query(SqliteWrapper.java: > 209) > 06-17 11:29:45.218: ERROR/AndroidRuntime(3881): at > com.android.mms.model.MediaModel.initAudioForDRM(MediaModel.java:361) > 06-17 11:29:45.218: ERROR/AndroidRuntime(3881): at > com.android.mms.model.MediaModel.<init>(MediaModel.java:86) > 06-17 11:29:45.218: ERROR/AndroidRuntime(3881): at > com.android.mms.model.AudioModel.<init>(AudioModel.java:58) > 06-17 11:29:45.218: ERROR/AndroidRuntime(3881): at > com.android.mms.model.AudioModel.<init>(AudioModel.java:52) > 06-17 11:29:45.218: ERROR/AndroidRuntime(3881): at > com.android.mms.ui.MediaPicker.makeNewAudio(MediaPicker.java:257) > 06-17 11:29:45.218: ERROR/AndroidRuntime(3881): at > com.android.mms.ui.MediaPicker.onMediaPicked(MediaPicker.java:346) > 06-17 11:29:45.218: ERROR/AndroidRuntime(3881): at > com.android.mms.ui.ComposeMessageActivity.handleSendIntent(ComposeMessageAc > tivity.java: > 4023) > 06-17 11:29:45.218: ERROR/AndroidRuntime(3881): at > com.android.mms.ui.ComposeMessageActivity.onCreate(ComposeMessageActivity.j > ava: > 2807) > 06-17 11:29:45.218: ERROR/AndroidRuntime(3881): at > android.app.Instrumentation.callActivityOnCreate(Instrumentation.java: > 1123) > 06-17 11:29:45.218: ERROR/AndroidRuntime(3881): at > android.app.ActivityThread.performLaunchActivity(ActivityThread.java: > 2418) > 06-17 11:29:45.218: ERROR/AndroidRuntime(3881): ... 11 more > > Anyone have an idea to fix this problem ?
-- 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