Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What to do when - java.io.FileNotFoundException: No content provider?

when I try to attach a file to an email, I get a java.io.FileNotFoundException: No content provider logcat output. If anyone could tell me what I am doing wrong or what I should do instead, that would be great.Thank you.

This is how I add the files to the email..:

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

...and here is the entire logcat error output:

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)
like image 977
kivy Avatar asked Jul 20 '10 09:07

kivy


People also ask

What is Java IO FileNotFoundException?

java.io.FileNotFoundException. Signals that an attempt to open the file denoted by a specified pathname has failed. This exception will be thrown by the FileInputStream , FileOutputStream , and RandomAccessFile constructors when a file with the specified pathname does not exist.

How do I access ContentProvider?

To access the content, define a content provider URI address. Create a database to store the application data. Implement the six abstract methods of ContentProvider class. Register the content provider in AndroidManifest.

What is a content provider android?

A content provider manages access to a central repository of data. A provider is part of an Android application, which often provides its own UI for working with the data. However, content providers are primarily intended to be used by other applications, which access the provider using a provider client object.


Video Answer


3 Answers

Maybe you should pass an uri of the form file:///sdcard/Video0006.mp4.

like image 142
SirDarius Avatar answered Oct 19 '22 02:10

SirDarius


You can also try this:

Uri.fromFile(new File(your image path));
like image 31
Gaurav S Avatar answered Oct 19 '22 02:10

Gaurav S


This worked for me

val uri:Uri =  File(path).toUri()
like image 5
Saurabh Dhage Avatar answered Oct 19 '22 02:10

Saurabh Dhage