3

I am going to use camera/gallery in my project. FOr this i have first taken picture and saved it in my folder(Suppose pictureworld) and also saved the imageuri in the localdatabase. Then when i am trying to get the picture to show it in the gridview i am getting a warning message. In the gridview there is no picture but it can view the picture name. I have checked that it is creating the picture and also the uri in the localdatabase is correct.I want to add that when i am trying to save the pic using the gallery ..there is no problem. I have used the same adapter for viewing the saved gallery and camera picture. I am attaching the warning here:

03-10 17:48:11.367: W/System.err(522):  at libcore.io.IoBridge.open(IoBridge.java:406)
03-10 17:48:11.367: W/System.err(522):  at java.io.FileInputStream.<init>(FileInputStream.java:78)
03-10 17:48:11.367: W/System.err(522):  at java.io.FileInputStream.<init>(FileInputStream.java:105)
03-10 17:48:11.367: W/System.err(522):  at android.content.ContentResolver.openInputStream(ContentResolver.java:369)
03-10 17:48:11.367: W/System.err(522):  at android.provider.MediaStore$Images$Media.getBitmap(MediaStore.java:705)
03-10 17:48:11.367: W/System.err(522):  at hr.s2is.ischool.admin.adapter.CommunityUserAdapter.getView(CommunityUserAdapter.java:71)
03-10 17:48:11.367: W/System.err(522):  at android.widget.AbsListView.obtainView(AbsListView.java:2033)
03-10 17:48:11.367: W/System.err(522):  at android.widget.GridView.makeAndAddView(GridView.java:1323)
03-10 17:48:11.377: W/System.err(522):  at android.widget.GridView.makeRow(GridView.java:328)
03-10 17:48:11.377: W/System.err(522):  at android.widget.GridView.fillDown(GridView.java:281)
03-10 17:48:11.377: W/System.err(522):  at android.widget.GridView.fillFromTop(GridView.java:403)
03-10 17:48:11.377: W/System.err(522):  at android.widget.GridView.layoutChildren(GridView.java:1215)
03-10 17:48:11.377: W/System.err(522):  at android.widget.AbsListView.onLayout(AbsListView.java:1863)
03-10 17:48:11.377: W/System.err(522):  at android.view.View.layout(View.java:11278)
03-10 17:48:11.377: W/System.err(522):  at android.view.ViewGroup.layout(ViewGroup.java:4224)
03-10 17:48:11.377: W/System.err(522):  at android.widget.RelativeLayout.onLayout(RelativeLayout.java:925)
03-10 17:48:11.387: W/System.err(522):  at android.view.View.layout(View.java:11278)
03-10 17:48:11.387: W/System.err(522):  at android.view.ViewGroup.layout(ViewGroup.java:4224)
03-10 17:48:11.387: W/System.err(522):  at android.widget.FrameLayout.onLayout(FrameLayout.java:431)
03-10 17:48:11.387: W/System.err(522):  at android.view.View.layout(View.java:11278)
03-10 17:48:11.387: W/System.err(522):  at android.view.ViewGroup.layout(ViewGroup.java:4224)
03-10 17:48:11.387: W/System.err(522):  at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1628)
03-10 17:48:11.397: W/System.err(522):  at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1486)
03-10 17:48:11.397: W/System.err(522):  at android.widget.LinearLayout.onLayout(LinearLayout.java:1399)
03-10 17:48:11.397: W/System.err(522):  at android.view.View.layout(View.java:11278)
03-10 17:48:11.397: W/System.err(522):  at android.view.ViewGroup.layout(ViewGroup.java:4224)
03-10 17:48:11.397: W/System.err(522):  at android.widget.FrameLayout.onLayout(FrameLayout.java:431)
03-10 17:48:11.397: W/System.err(522):  at android.view.View.layout(View.java:11278)
03-10 17:48:11.397: W/System.err(522):  at android.view.ViewGroup.layout(ViewGroup.java:4224)
03-10 17:48:11.407: W/System.err(522):  at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1489)
03-10 17:48:11.407: W/System.err(522):  at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2442)
03-10 17:48:11.407: W/System.err(522):  at android.os.Handler.dispatchMessage(Handler.java:99)
03-10 17:48:11.407: W/System.err(522):  at android.os.Looper.loop(Looper.java:137)
03-10 17:48:11.407: W/System.err(522):  at android.app.ActivityThread.main(ActivityThread.java:4424)
03-10 17:48:11.407: W/System.err(522):  at java.lang.reflect.Method.invokeNative(Native Method)
03-10 17:48:11.417: W/System.err(522):  at java.lang.reflect.Method.invoke(Method.java:511)
03-10 17:48:11.417: W/System.err(522):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
03-10 17:48:11.417: W/System.err(522):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
03-10 17:48:11.417: W/System.err(522):  at dalvik.system.NativeStart.main(Native Method)
03-10 17:48:11.417: W/System.err(522): Caused by: libcore.io.ErrnoException: open failed: ENOENT (No such file or directory)
03-10 17:48:11.427: W/System.err(522):  at libcore.io.Posix.open(Native Method)
03-10 17:48:11.427: W/System.err(522):  at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110)
03-10 17:48:11.427: W/System.err(522):  at libcore.io.IoBridge.open(IoBridge.java:390)
Developer
  • 385
  • 1
  • 3
  • 18
  • 2
    post your file root code you are trying to write in root – DjHacktorReborn Mar 10 '13 at 12:13
  • file:///mnt/sdcard/my%20folder/1362676603888.png it is the file name of my picture . in the database it is saved as this directory.Here is the code : File directory=new File(Environment.getExternalStorageDirectory().getAbsolutePath(),"my folder"); – Developer Mar 10 '13 at 12:21
  • can you post relevant code for your concern, the one above is not enough or maybe atleast edit your question and add it there, also include relevant xml tags in your manifest. – She Smile GM Mar 19 '13 at 02:44
  • Check here [related to your question][1] Also go through [this:][2] [1]: http://stackoverflow.com/questions/11620641/android-error-open-failed-enoent [2]: http://stackoverflow.com/questions/10724132/file-creation-with-funny-file-name-crash-with-an-ugly-exception – sai Mar 19 '13 at 13:09
  • looking at your Logs I can see its something to deal with the image being cast on the view,would you supply code to show how you are doing it? – James Wahome Mar 19 '13 at 06:02

2 Answers2

0

Have you given the permission to read the local storage? You should check if any permission is declared in Android Manifest regarding Writing and reading of Internal Storage.

Parvaz Bhaskar
  • 1,367
  • 9
  • 29
0

did you add permissions

  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

One more thing:

With sdk, you can't write to the root of internal storage. This cause your error.Try something like this

final File dir = new File(context.getFilesDir() + "/nfs/guille/groce/users/nicholsk/workspace3/SQLTest");
dir.mkdirs(); //create folders where write files
final File file = new File(dir, "BlockForTest.txt");
Janmejoy
  • 2,721
  • 1
  • 20
  • 38