BitmapFactory.decodeStream sometimes returns null

Try new BufferedHttpEntity (entity);
before calling getContent()




On Oct 27, 7:45 pm, Tom <[email protected]> wrote:
> Hi,
>
> I was having the same problem. It stoped when i gave the images i was
> loading the header Content-Length.
>
> Hope this helps.
>
> On 21 Oct, 14:13, Streets Of Boston <[email protected]> wrote:
>
> > Hi everyone,
>
> > Without (sample) code or a log-trace, there is not much that we can do
> > to help you.
>
> > On Oct 20, 11:44 am, "kevin.hooke" <[email protected]> wrote:
>
> > > I'm having a similar problem whereBitmapFactory.decodeStream() is
> > > working reliably in the emulator, but the same app transferred to the
> > > phone is returning null everytime.
>
> > > Any ideas?
>
> > > Kevin Hooke
>
> > > On Oct 14, 5:10 pm, "anthony.dahanne" <[email protected]>
> > > wrote:
>
> > > > Hello !
> > > > I'm experiencing exactly the same problem (working every time while
> > > > debugging with breakpoints; sometimes failing while normally running),
> > > > on Android 1.5
> > > > Did you solve this problem ?
> > > > Anthony
>
> > > > On Oct 3, 6:09 am, RoryD <[email protected]> wrote:
>
> > > > > I have an activity which performs an image search, the results (URLs
> > > > > of thumbnails on the web) are rendered in a GridView.
>
> > > > > My GridView adapter class delegates creating the actual Bitmaps to an
> > > > > AsyncTask that loops to sequentially fetch the image content from each
> > > > > URL using HTTPClient, and creates the Bitmaps using:
>
> > > > >BitmapFactory.decodeStream(entity.getContent()).
>
> > > > > I found that the above method sometimes returns "null" silently
> > > > > instead of creating a Bitmap.   The occurrences appear to correlate
> > > > > with larger stream sizes (I check this by logging
> > > > > entity.getContentLength()).  However, if I put a breakpoint just prior
> > > > > to the decodeStream call & then resume immediately every time I hit it
> > > > > (i.e. pause briefly on each iteration), the Bitmaps are created
> > > > > perfectly every time.
>
> > > > > All the images are quite small (most <10K), so the download &
> > > > > decodeStream happens fairly quickly.  There are never more than 10
> > > > > images processed in one AsyncTask.
>
> > > > > Any ideas on what's going wrong?- Hide quoted text -
>
> > > - Show quoted text -

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