nostra13 / Android-Universal-Image-Loader

Powerful and flexible library for loading, caching and displaying images on Android.
Apache License 2.0
16.79k stars 6.1k forks source link

ClassCastException in BaseImageDownloader.java:164 #184

Closed accandme closed 11 years ago

accandme commented 11 years ago

while loading drawable://17301522 a class cast exception is thrown : android.graphics.drawable.NinePatchDrawable and the "on error" image is displayed

nostra13 commented 11 years ago

Why do you try to display drawable with ImageLoader instead of imageView.setImageDrawable(...)?

accandme commented 11 years ago

Because I have a generic code that uses your ImageLoader, and I control what image is to be displayed from the server. Most of the time I display external images, but in a few cases I need to display images from the drawable folder. Anyway, I did a work around for the time being. For your info, your loader loads correctly drawables that are not 9patch, but fails for all 9patch images.

nostra13 commented 11 years ago

Yes, I didn't consider NinePatchDrawable (and other Drawable subclasses except BitmapDrawable). But it's really pointless to load them using UIL. I need to construct InputStream from drawable but I can do it only for BitmapDrawable.

I won't add support for 9pathch drawables. Actually I'm not sure it was a good idea to add support for drawables at all because people overuse this possibility when they really don't need it.

accandme commented 11 years ago

OK. It is fine with me. I worked around it. But just wanted to let you know about the limitation of your UIL ;-)

nostra13 commented 11 years ago

Ok, thanks.