web-dev-qa-db-fra.com

Que faire quand - Java.io.FileNotFoundException: aucun fournisseur de contenu?

lorsque j'essaie de joindre un fichier à un e-mail, j'obtiens une exception Java.io.FileNotFoundException: aucune sortie logcat du fournisseur de contenu. Si quelqu'un pouvait me dire ce que je fais mal ou ce que je devrais faire à la place, ce serait bien, merci.

Voici comment j'ajoute les fichiers à l'e-mail ..:

Intent sendIntent = new Intent(Intent.ACTION_SEND);
                sendIntent.putExtra(Intent.EXTRA_STREAM, uri);
                sendIntent.setType("video/3gp");
                sendIntent.setType("video/mp4");
                startActivity(sendIntent);

... et voici la sortie d'erreur logcat entière:

07-20 09:15:58.364: ERROR/Mms/media(168): IOException caught while opening or reading stream
07-20 09:15:58.364: ERROR/Mms/media(168): Java.io.FileNotFoundException: No content provider: /sdcard/Video0006.mp4
07-20 09:15:58.364: ERROR/Mms/media(168):     at Android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.Java:507)
07-20 09:15:58.364: ERROR/Mms/media(168):     at Android.content.ContentResolver.openInputStream(ContentResolver.Java:345)
07-20 09:15:58.364: ERROR/Mms/media(168):     at com.Android.mms.model.MediaModel.initMediaSize(MediaModel.Java:268)
07-20 09:15:58.364: ERROR/Mms/media(168):     at com.Android.mms.model.MediaModel.<init>(MediaModel.Java:76)
07-20 09:15:58.364: ERROR/Mms/media(168):     at com.Android.mms.model.RegionMediaModel.<init>(RegionMediaModel.Java:40)
07-20 09:15:58.364: ERROR/Mms/media(168):     at com.Android.mms.model.VideoModel.<init>(VideoModel.Java:55)
07-20 09:15:58.364: ERROR/Mms/media(168):     at com.Android.mms.model.VideoModel.<init>(VideoModel.Java:48)
07-20 09:15:58.364: ERROR/Mms/media(168):     at com.Android.mms.data.WorkingMessage.changeMedia(WorkingMessage.Java:434)
07-20 09:15:58.364: ERROR/Mms/media(168):     at com.Android.mms.data.WorkingMessage.setAttachment(WorkingMessage.Java:343)
07-20 09:15:58.364: ERROR/Mms/media(168):     at com.Android.mms.ui.ComposeMessageActivity.addVideo(ComposeMessageActivity.Java:2472)
07-20 09:15:58.364: ERROR/Mms/media(168):     at com.Android.mms.ui.ComposeMessageActivity.addAttachment(ComposeMessageActivity.Java:2544)
07-20 09:15:58.364: ERROR/Mms/media(168):     at com.Android.mms.ui.ComposeMessageActivity.handleSendIntent(ComposeMessageActivity.Java:2521)
07-20 09:15:58.364: ERROR/Mms/media(168):     at com.Android.mms.ui.ComposeMessageActivity.initialize(ComposeMessageActivity.Java:1703)
07-20 09:15:58.364: ERROR/Mms/media(168):     at com.Android.mms.ui.ComposeMessageActivity.onCreate(ComposeMessageActivity.Java:1633)
07-20 09:15:58.364: ERROR/Mms/media(168):     at Android.app.Instrumentation.callActivityOnCreate(Instrumentation.Java:1047)
07-20 09:15:58.364: ERROR/Mms/media(168):     at Android.app.ActivityThread.performLaunchActivity(ActivityThread.Java:2459)
07-20 09:15:58.364: ERROR/Mms/media(168):     at Android.app.ActivityThread.handleLaunchActivity(ActivityThread.Java:2512)
07-20 09:15:58.364: ERROR/Mms/media(168):     at Android.app.ActivityThread.access$2200(ActivityThread.Java:119)
07-20 09:15:58.364: ERROR/Mms/media(168):     at Android.app.ActivityThread$H.handleMessage(ActivityThread.Java:1863)
07-20 09:15:58.364: ERROR/Mms/media(168):     at Android.os.Handler.dispatchMessage(Handler.Java:99)
07-20 09:15:58.364: ERROR/Mms/media(168):     at Android.os.Looper.loop(Looper.Java:123)
07-20 09:15:58.364: ERROR/Mms/media(168):     at Android.app.ActivityThread.main(ActivityThread.Java:4363)
07-20 09:15:58.364: ERROR/Mms/media(168):     at Java.lang.reflect.Method.invokeNative(Native Method)
07-20 09:15:58.364: ERROR/Mms/media(168):     at Java.lang.reflect.Method.invoke(Method.Java:521)
07-20 09:15:58.364: ERROR/Mms/media(168):     at com.Android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.Java:860)
07-20 09:15:58.364: ERROR/Mms/media(168):     at com.Android.internal.os.ZygoteInit.main(ZygoteInit.Java:618)
07-20 09:15:58.364: ERROR/Mms/media(168):     at dalvik.system.NativeStart.main(Native Method)
39
kivy

Vous devriez peut-être passer un uri de la forme file:///sdcard/Video0006.mp4.

83
SirDarius

Vous pouvez également essayer ceci:

Uri.fromFile(new File(your image path));
61
Gaurav S