Closed Niksac closed 11 years ago
I just started on this yesterday. I see what you mean about context. Care to share your code?
This repo might provide some insight too.
You say "loaded views into it within the oncreate code oh my activity". Can you show this code please? I mean code where you create ImageView or inflate it from xml. I ask because I suspect you pass application context when you create imageviews. You should pass activity context. I faced something like that before.
this error appeared because all activities are contexts, but not all contexts are activities. I think the ImageView was not created from an activity.
It's already fixed in the latest sources. I don't use getContext() any more.
Hi
I love the lazylist and in particular the ImageLoader. It worked fine for me until i tried something new :
I created a horizontal Scroller and loaded views into it within the oncreate code oh my activity. After creating a such ImageView (which is in a layout which i add to the horizontal scroller) i used DisplayImage(img, iv) to get a picture from an url into it.
Well it never worked .. no exceptions, no result at all. I analyzed all the ImageLoader code and used Logcat to find the command which caused the behavior.
The issue is in the run method of the PhotosLoader class which will try to get the activity the imageView lives in to let its UI Thread set the image bitmap:
Based on Logcat outputs i think my view will return an application object in this case:
I fixxed the issue by passing my activity into the ImageLoader via constructor and from there pass it into the PhotosLoader. I don't hink that's a clever approach but it works.
Any ideas how to fix this ?
Nik