-
Notifications
You must be signed in to change notification settings - Fork 498
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ImageLoader with fragments #7
Comments
Hi Fedor, I used your lib in my project inside the fragment with a gridview. And it works just perfect. Best regards, Nikolay |
Hi Fedor, Like I promised, here is a demo app: https://github.com/DushyanthMaguluru/LazyListFragment that fails to set images correctly. I used a Cursor adapter in combination with a ContentProvider. You should notice that once you click on "Launch UserList" button on the main view, all the images are set to the default image. Only if you scroll down to the bottom and scroll back up, you will see the images being refreshed. And if you look at the logcat you will notice that you will only see these lines:
Note: I also tried setting the tag like you recommended on a different ticket, image.setTag(url). The results didn't change though. Finally, I am sorry if there is actually a mistake in my implementation. Thanks, |
Dushyanth, thank you very much for the code. Now the question is should I make a fix to allow ImageLoader work even under application context not just activity context. I'll have to create additional handlers for that as proposed by Vladislav gingo@e9e2c83. I'm not sure about that yet. Actually if you use ImageLoader you always have Activity and you can pass it not an application. |
Fedor, Thanks so much for correcting my mistake and proving that I am stupid :D. I am sorry to have wasted your time. |
Don't worry, you just helped me to figure out a weak place that can cause problems for many other people. So you contribution is highly appreciated. |
Thank you. As for changing the ImageLoader to use Handlers, I agree with your point that ImageLoader always has an activity. So not sure if its worth implementing the Handler architecture. |
Hi Fedor I just recently ran into your mail regarding this issue and just became curious about testing in which situations Lazylist works with Fragments. I then saw, that this was covered here already ;) But I tested your idea intensivly about using ImageView.post(Runnable r) and it works like a charm.
instead of
Works like a charm in every situation i encountered. I also implemented a animation for showing the images. If your interested let me know. With best regards |
I don't use post() any more. Official documentation ways post() will not If you have a nice animations code you can form my project on github and 12 марта 2012 г. 2:20 пользователь johnnycube <
|
Hi Fedor public class MyFragment extends Fragment{
} I'm doing everything from a fragment and I boot ERROR on line: Activity a=(Activity)photoToLoad.imageView.getContext(); any solution to this? |
I happens because getContext() returns Application context not Activity context. I have just commited a fix, please try it 232d7f6. It uses hander to run the UI job so it doesn't depend on Activity. Should work fine for you now. |
Thank you! works well, the only thing is that the images are too small, see if there's something wrong with my code, thanks for the support |
I'm getting error "Can't create handler inside thread that has not called looper.prepare() " |
Probably because you create ImageLoader in some thread that is not UI thread. |
thanks , my problem is solved. I have one more issue. I want to resize my downloaded bitmap image . Alrdy seen this issue #19 and you suggested to disable it if dont need it. I just want to show image as 64 X 64 , so wht should i do ? |
Several people have reported me that ImageLoader doesn't display bitmaps correctly if used inside fragments. Unfortunately I can't reproduce this problem - it works just fine for me. It would be great if someone could attach a demo project with the problem inside. Have some ideas how to fix it. But before applying the fix need to be able to reproduce the problem and test it well.
The text was updated successfully, but these errors were encountered: