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