web-dev-qa-db-ja.com

いつ何をすべきか-Java.io.FileNotFoundException:コンテンツプロバイダーがありませんか?

電子メールにファイルを添付しようとすると、Java.io.FileNotFoundException:No content provider logcat outputが表示されます。誰かが私が間違っていることや代わりにすべきことを教えてくれたら、それは素晴らしいことです。ありがとう。

これは私が電子メールにファイルを追加する方法です。

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

...そしてlogcatのエラー出力全体は次のとおりです。

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

たぶん、あなたはfile:///sdcard/Video0006.mp4

83
SirDarius

これを試すこともできます:

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