The fix is simple, initialize you array photos. In the bug report you
filed, the array itself is null. The Bitmap returned by BitmapFactory
is not.

On Tue, Sep 30, 2008 at 2:17 AM, Matteo Crippa <[EMAIL PROTECTED]> wrote:
>
> Easy i was playing with a little app i'm developing but i've just
> found a little problem... let's explain me it...
>
> I created a sdcard and inside it I placed some jpg files.
>
> So my data path is something like:
>
> /sdcard/app/img/1.jpg
> /sdcard/app/img/2.jpg
> /sdcard/app/img/3.jpg
> /sdcard/app/img/4.jpg
> [...]
> /sdcard/app/img/n.jpg
>
> Now I want to create a gallery app to show out these files, I looked
> at demo srcs by android sdk, but they always use imgs from
> resources...
>
> I decided to try using Bitmapfactory.decodeFile and also
> Bitmapfactory.decodestream but both seems not to work fine returning a
> NullPointerException
>
> Here you are a little snippet of my app:
>
> Java:
>
> for(int i=0;i<imgsTokens.length;i++)
>               {
>                    Log.d(""+i,"/sdcard/app/img/"+imgsTokens[i]
> +".jpg");
>                    try
>                    {
>                         FileInputStream is = new FileInputStream(new
> File("/sdcard/app/img/"+imgsTokens[i]+".jpg"));
>                         BufferedInputStream bis = new
> BufferedInputStream(is);
>                         photos[i] = BitmapFactory.decodeStream(is);
>                         bis.close();
>                         is.close();
>
>                         //photos[i] = BitmapFactory.decodeFile("/
> sdcard/app/img/"+imgsTokens[i]+".jpg");
>                    }
>                    catch(Exception e)
>                    {
>                         e.printStackTrace();
>                    }
>               }
>
>
>
>
> any idea how to fix?
> >
>



-- 
Romain Guy
www.curious-creature.org

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to