getURLBytes() not loading properly on alternative method


Hey Brian & phillips,

Instead of redirecting the users to the webpage (when they click the gridview), I wanted to utilize the ImageFragment method we used back in the Criminal Intent application. So, I did everything just like the one in Criminal Intent application except instead of supplying a path, I supplied the URL of the GalleryItem. Similar to how ThumbnailDownloader retrieved the images by calling flickrfetchr.geturlbytes(), I did the exact same thing and set it to the imageview. However, when I click on the image, I only get an empty imagefragment, with the value of null supplied to setImageDrawable().

it seems like there’s an error during connection.getInputStream() since my log file won’t show anything afterwards. I know the method is correct since the images do show during thumbnails. Is there a reason why getURLBytes works for the Thumbnail thread but not for the imagefragment?

thanks, and let me know if you want to see the code.

P.S. Great book so far


I think the issue probably is - After you get past the Mutli Threading Chapter… you would have moved the the getURLBytes from Async task to a Thread.

You are likely (If Im not wrong) you will get an error when you call

InputStream in = connection.getInputStream(); – That’s bcoz - Honeycomb and above you cannot run this on a main thread - it has to be on separate thread.

Possible Errata?