I posted a response to the above link from Stefan

 I found at 
http://groups.google.com/group/android-developers/browse_thread/thread/171b8bf35dbbed96/c3ec5f45436ceec8?lnk=raot.
(thanks Nilesh).  You need to add "BufferedHttpEntity bufHttpEntity =
new BufferedHttpEntity(entity); "


Here was my previous code:



                conn = (HttpURLConnection) bitmapUrl.openConnection();
                conn.connect();
                is = conn.getInputStream();
                //bis = new BufferedInputStream(is);
                //bm = BitmapFactory.decodeStream(bis);
                bm = BitmapFactory.decodeStream(is);



And her is the code that works:


                HttpGet httpRequest = null;

                try {
                        httpRequest = new HttpGet(bitmapUrl.toURI());
                } catch (URISyntaxException e) {
                        e.printStackTrace();
                }

                HttpClient httpclient = new DefaultHttpClient();
                HttpResponse response = (HttpResponse) httpclient.execute
(httpRequest);

                HttpEntity entity = response.getEntity();
                BufferedHttpEntity bufHttpEntity = new BufferedHttpEntity
(entity);
                InputStream instream = bufHttpEntity.getContent();
                bm = BitmapFactory.decodeStream(instream);



I have a page that download around 40 images, and you can refresh to
see the most recent photos.  I would have almost half fail with the
"decoder->decode returned false error".  With the above code, I have
had no problems.

Thanks




On Nov 24, 4:17 am, Stefan Klumpp <stefan.klu...@gmail.com> wrote:
> I've done more testing and tried out different stuff. I've posted a
> detailed description 
> here:http://stackoverflow.com/questions/1630258/android-bitmapfactory-deco...
>
> However, still no perfect solution at this point.
>
> On Nov 24, 11:02 am, Stefan Klumpp <stefan.klu...@gmail.com> wrote:
>
>
>
> > Still no solution for that, but it seems that other developers have
> > similar problems. The strange thing is that exactly the same image
> > usually doesn't work, but sometimes it actually does. No idea why
> > though.
>
> > On Oct 27, 12:28 pm, Stefan Klumpp <stefan.klu...@gmail.com> wrote:
>
> > > For my current application I collect images from different "event
> > > providers" in Spain.
>
> > > However, when downloading images from salir.com I get the following
> > > logcat output:
> > > 13970       Gallery_Activity  I  Fetching image 2/8 
> > > URL:http://media.salir.com/_images_/verticales/a/0/1/0/2540-los_inmortale...
> > > 13970     ServiceHttpRequest  I  Image [http://media.salir.com/
> > > _images_/verticales/a/0/1/0/2540-los_inmortales_la_trattoria-
> > > marc_aureli_27_29_no.jpg] fetched in [146ms]
> > > 13970                   skia  D  --- decoder->decode returned
> > > false
>
> > > Searching for that error message didn't provide much useful results.
>
> > > Anyone an idea what the problem could be?
>
> > > Gracias!

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

Reply via email to