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

Discussion in 'Application Development' started by kivy, Jul 20, 2010.

  1. kivy

    kivy Member
    15

    Jul 13, 2010
    17
    0
    15
    Hi everyone,

    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..:

    Code (Text):
    1. Intent sendIntent = new Intent(Intent.ACTION_SEND);
    2.                sendIntent.putExtra(Intent.EXTRA_STREAM, uri);
    3.                sendIntent.setType("video/3gp");
    4.                sendIntent.setType("video/mp4");
    5.                startActivity(sendIntent);
    6.  
    ...and here is the entire logcat error output:

    Code (Text):
    1. 20 09:15:58.364: ERROR/Mms/media(168): IOException caught while
    2. opening or reading stream
    3. 07-20 09:15:58.364: ERROR/Mms/media(168):
    4. java.io.FileNotFoundException: No content provider: /sdcard/
    5. Video0006.mp4
    6. 07-20 09:15:58.364: ERROR/Mms/media(168):     at
    7. android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:
    8. 507)
    9. 07-20 09:15:58.364: ERROR/Mms/media(168):     at
    10. android.content.ContentResolver.openInputStream(ContentResolver.java:
    11. 345)
    12. 07-20 09:15:58.364: ERROR/Mms/media(168):     at
    13. com.android.mms.model.MediaModel.initMediaSize(MediaModel.java:268)
    14. 07-20 09:15:58.364: ERROR/Mms/media(168):     at
    15. com.android.mms.model.MediaModel.<init>(MediaModel.java:76)
    16. 07-20 09:15:58.364: ERROR/Mms/media(168):     at
    17. com.android.mms.model.RegionMediaModel.<init>(RegionMediaModel.java:
    18. 40)
    19. 07-20 09:15:58.364: ERROR/Mms/media(168):     at
    20. com.android.mms.model.VideoModel.<init>(VideoModel.java:55)
    21. 07-20 09:15:58.364: ERROR/Mms/media(168):     at
    22. com.android.mms.model.VideoModel.<init>(VideoModel.java:48)
    23. 07-20 09:15:58.364: ERROR/Mms/media(168):     at
    24. com.android.mms.data.WorkingMessage.changeMedia(WorkingMessage.java:
    25. 434)
    26. 07-20 09:15:58.364: ERROR/Mms/media(168):     at
    27. com.android.mms.data.WorkingMessage.setAttachment(WorkingMessage.java:
    28. 343)
    29. 07-20 09:15:58.364: ERROR/Mms/media(168):     at
    30. com.android.mms.ui.ComposeMessageActivity.addVideo(ComposeMessageActivity.java:
    31. 2472)
    32. 07-20 09:15:58.364: ERROR/Mms/media(168):     at
    33. com.android.mms.ui.ComposeMessageActivity.addAttachment(ComposeMessageActivity.java:
    34. 2544)
    35. 07-20 09:15:58.364: ERROR/Mms/media(168):     at
    36. com.android.mms.ui.ComposeMessageActivity.handleSendIntent(ComposeMessageActivity.java:
    37. 2521)
    38. 07-20 09:15:58.364: ERROR/Mms/media(168):     at
    39. com.android.mms.ui.ComposeMessageActivity.initialize(ComposeMessageActivity.java:
    40. 1703)
    41. 07-20 09:15:58.364: ERROR/Mms/media(168):     at
    42. com.android.mms.ui.ComposeMessageActivity.onCreate(ComposeMessageActivity.java:
    43. 1633)
    44. 07-20 09:15:58.364: ERROR/Mms/media(168):     at
    45. android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:
    46. 1047)
    47. 07-20 09:15:58.364: ERROR/Mms/media(168):     at
    48. android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
    49. 2459)
    50. 07-20 09:15:58.364: ERROR/Mms/media(168):     at
    51. android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
    52. 2512)
    53. 07-20 09:15:58.364: ERROR/Mms/media(168):     at
    54. android.app.ActivityThread.access$2200(ActivityThread.java:119)
    55. 07-20 09:15:58.364: ERROR/Mms/media(168):     at
    56. android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
    57. 07-20 09:15:58.364: ERROR/Mms/media(168):     at
    58. android.os.Handler.dispatchMessage(Handler.java:99)
    59. 07-20 09:15:58.364: ERROR/Mms/media(168):     at
    60. android.os.Looper.loop(Looper.java:123)
    61. 07-20 09:15:58.364: ERROR/Mms/media(168):     at
    62. android.app.ActivityThread.main(ActivityThread.java:4363)
    63. 07-20 09:15:58.364: ERROR/Mms/media(168):     at
    64. java.lang.reflect.Method.invokeNative(Native Method)
    65. 07-20 09:15:58.364: ERROR/Mms/media(168):     at
    66. java.lang.reflect.Method.invoke(Method.java:521)
    67. 07-20 09:15:58.364: ERROR/Mms/media(168):     at
    68. com.android.internal.os.ZygoteInit
    69. $MethodAndArgsCaller.run(ZygoteInit.java:860)
    70. 07-20 09:15:58.364: ERROR/Mms/media(168):     at
    71. com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
    72. 07-20 09:15:58.364: ERROR/Mms/media(168):     at
    73. dalvik.system.NativeStart.main(Native Method)
     

    Advertisement
  2. Boogs

    Boogs Well-Known Member
    18

    Apr 6, 2010
    85
    16
    18
    Can you show us what you're setting "uri"equal to? That seems to be the heart of the problem.
     
  3. kivy

    kivy Member
    15

    Jul 13, 2010
    17
    0
    15
    Of course :)

    Here it is:

    Code (Text):
    1. String [] proj={MediaStore.Video.Media.DATA};
    2. videocursor = managedQuery( MediaStore.Video.Media.EXTERNAL_CONTENT_URI, proj, null,null,null);    
    3. videocursor.moveToPosition(position);
    4. String uri = Uri.parse(videocursor.getString(0));
    5. Log.d("EditGalleryView", "pos: "+position+", uri: "+uri);
     
  4. android2dev

    android2dev Active Member
    16

    Jul 15, 2010
    32
    4
    16
    Entrepreneur/Mobile Developer
    Well start with the simple stuff. Is the file there? Is the path correct? You may want to test if the file exists before attempting to attach. Create a new file object passing the full path then test the fObj.exists().
     
  5. kivy

    kivy Member
    15

    Jul 13, 2010
    17
    0
    15
    Did it and yes, it exists... The path is also correct...
     
  6. Boogs

    Boogs Well-Known Member
    18

    Apr 6, 2010
    85
    16
    18
    Try this:
    Code (Text):
    1.  
    2. String uri = Uri.parse("file://" + videocursor.getString(0));
     
  7. kivy

    kivy Member
    15

    Jul 13, 2010
    17
    0
    15
    I already did...and tried everything but nothing seems to work :(

    This is how I tried it:

    Code (Text):
    1. Uri uri = Uri.parse("file://" + videocursor.getString(0));
    2.                
    3.                 Intent sendIntent = new Intent(Intent.ACTION_SEND);
    4.                 sendIntent.putExtra(Intent.EXTRA_STREAM, uri);
    5.                 sendIntent.setType("video/3gp");
    6.                 sendIntent.setType("video/mp4");
    7.                 startActivity(sendIntent);
    8.                 Log.d("EditGallerView path", uri.toString());
    9.                 return true;
     

Share This Page

Loading...