Did you ever get to the bottom of this?

I'm trying to load an image in from the fs and the logcat gives me...

W/System.err(  283): java.io.IOException: Is a directory
W/System.err(  283):    at
org.apache.harmony.luni.platform.OSFileSystem.readImpl(Native Method)
W/System.err(  283):    at
org.apache.harmony.luni.platform.OSFileSystem.read(OSFileSystem.java:
150)
W/System.err(  283):    at java.io.FileInputStream.read
(FileInputStream.java:306)
W/System.err(  283):    at java.io.BufferedInputStream.fillbuf
(BufferedInputStream.java:177)
W/System.err(  283):    at java.io.BufferedInputStream.read
(BufferedInputStream.java:310)
W/System.err(  283):    at
android.graphics.BitmapFactory.nativeDecodeStream(Native Method)
W/System.err(  283):    at android.graphics.BitmapFactory.decodeStream
(BitmapFactory.java:304)
W/System.err(  283):    at android.graphics.BitmapFactory.decodeFile
(BitmapFactory.java:149)
W/System.err(  283):    at android.graphics.BitmapFactory.decodeFile
(BitmapFactory.java:174)
W/System.err(  283):    at
android.graphics.drawable.Drawable.createFromPath(Drawable.java:729)
W/System.err(  283):    at android.widget.ImageView.resolveUri
(ImageView.java:484)
W/System.err(  283):    at android.widget.ImageView.setImageURI
(ImageView.java:281)
W/System.err(  283):    at android.widget.SimpleAdapter.setViewImage
(SimpleAdapter.java:243)
W/System.err(  283):    at android.widget.SimpleAdapter.bindView
(SimpleAdapter.java:171)
W/System.err(  283):    at
android.widget.SimpleAdapter.createViewFromResource(SimpleAdapter.java:
121)
W/System.err(  283):    at android.widget.SimpleAdapter.getView
(SimpleAdapter.java:110)
W/System.err(  283):    at android.widget.AbsListView.obtainView
(AbsListView.java:1075)
W/System.err(  283):    at android.widget.ListView.makeAndAddView
(ListView.java:1616)
W/System.err(  283):    at android.widget.ListView.fillDown
(ListView.java:601)
W/System.err(  283):    at android.widget.ListView.fillFromTop
(ListView.java:658)
W/System.err(  283):    at android.widget.ListView.layoutChildren
(ListView.java:1476)
W/System.err(  283):    at android.widget.AbsListView.onLayout
(AbsListView.java:937)
W/System.err(  283):    at android.view.View.layout(View.java:5637)
W/System.err(  283):    at android.widget.LinearLayout.setChildFrame
(LinearLayout.java:1119)
W/System.err(  283):    at android.widget.LinearLayout.layoutVertical
(LinearLayout.java:999)
W/System.err(  283):    at android.widget.LinearLayout.onLayout
(LinearLayout.java:920)
W/System.err(  283):    at android.view.View.layout(View.java:5637)
W/System.err(  283):    at android.widget.FrameLayout.onLayout
(FrameLayout.java:294)
W/System.err(  283):    at android.view.View.layout(View.java:5637)
W/System.err(  283):    at android.widget.LinearLayout.setChildFrame
(LinearLayout.java:1119)
W/System.err(  283):    at android.widget.LinearLayout.layoutVertical
(LinearLayout.java:999)
W/System.err(  283):    at android.widget.LinearLayout.onLayout
(LinearLayout.java:920)
W/System.err(  283):    at android.view.View.layout(View.java:5637)
W/System.err(  283):    at android.widget.FrameLayout.onLayout
(FrameLayout.java:294)
W/System.err(  283):    at android.view.View.layout(View.java:5637)
W/System.err(  283):    at android.view.ViewRoot.performTraversals
(ViewRoot.java:771)
W/System.err(  283):    at android.view.ViewRoot.handleMessage
(ViewRoot.java:1103)
W/System.err(  283):    at android.os.Handler.dispatchMessage
(Handler.java:88)
W/System.err(  283):    at android.os.Looper.loop(Looper.java:123)
W/System.err(  283):    at android.app.ActivityThread.main
(ActivityThread.java:3742)
W/System.err(  283):    at java.lang.reflect.Method.invokeNative(Native
Method)
W/System.err(  283):    at java.lang.reflect.Method.invoke(Method.java:
515)
W/System.err(  283):    at com.android.internal.os.ZygoteInit
$MethodAndArgsCaller.run(ZygoteInit.java:739)
W/System.err(  283):    at com.android.internal.os.ZygoteInit.main
(ZygoteInit.java:497)
W/System.err(  283):    at dalvik.system.NativeStart.main(Native Method)
D/skia    (  283): xxxxxxxxxxx jpeg error 20 Improper call to JPEG
library in state %d

using the code

Bitmap bmImg = BitmapFactory.decodeFile("/files/steeley.jpg");

Thx


On Dec 29 2008, 2:07 pm, longhairedsi <longhaire...@googlemail.com>
wrote:
> Hi,
>
> I have the same problem, I'm saving to the local app data store, I can
> see the file using DDMS but when i try to open the file it is always
> null. I think my problem may be as I'm using just the filename. eg.
>
> to save:
> FileOutputStream stream = mContext.openFileOutput("pic1.png",
> Context.MODE_WORLD_READABLE);
>
> to load
> Bitmap bm = BitmapFactory.decodeFile("pic1.png");
>
> The api docs say about the BitmapFactory.decodeFilepathName
> parameter:
>
> "pathName  complete path name for the file to be decoded." How do I
> find the full path to the app data store?
>
> Cheers
> Si
>
> On Dec 10, 10:02 pm, fala70 <fal...@gmail.com> wrote:
>
>
>
>
>
> > I did an application that create an image file copied from external
> > memory with follow code:
> >                                Bitmap bitmap = Media.getBitmap
> > (getContentResolver(), uri);
>
> >                                 ByteArrayOutputStream bytes = new
> > ByteArrayOutputStream();
> >                                 boolean besito=bitmap.compress
> > (Bitmap.CompressFormat.JPEG, 90, bytes);
>
> >                                 String sPath=uri.getPath();
> >                                 String 
> > sNum=sPath.substring(sPath.lastIndexOf
> > ("/")+1);
> >                                 String sFileName =sNum+".jpg";
> >                                 deleteFile(sFileName);
> >                                 FileOutputStream fos = 
> > openFileOutput(sFileName,
> > MODE_WORLD_WRITEABLE);
> >                                 fos.write(bytes.toByteArray());
> >                                 fos.close();
>
> > that code save the to internal memory area application and work. Now I
> > 've a problem on BitmapFactory.decodeFilewhen I try to reload this
> > file, BitmapFactory.decodeFilereturn null:
>
> >                                 ImageView img= (ImageView) findViewById
> > (R.id.imgThumb);
> >                                 Bitmap bm = BitmapFactory.decodeFile
> > (sFileName);
> >                                 BitmapDrawable drawable = new BitmapDrawable
> > (bitmap);
> >                                 img.setImageDrawable(drawable);
>
> > somebody can help to understand why BitmapFactory.decodeFilereturn
> > null ?
> > thanks
>
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to