Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

When using an dynamic adapter, updates cause images to flash #54

Closed
dwa012 opened this Issue · 11 comments

4 participants

@dwa012

I have an adapter that dynamically loads content when the bottom of the list is reached. I fetch new content and load the new items in the adapter and call notifyDataChanged().

This then causes a redraw of the view. When the view is redrawn the images must be reloaded from the ImageManager, which then fetches them from the cache. The causes about a 300ms delay. This in turn looks like the images flash. I am not sure how to overcome this.

Is there a way to have the images stored in RAM and fetch from there? I am using the LRU cache as well.

@luigi-agosti

How are you using the imageLoader ... in the application class as in the documentation?
do you keep a static reference of it?

If you are using LRU cache you already have the images on the memory unless you have big images as they may take lots of memory...
not sure what is generating this 300ms of delay

is your app on the market?

you should set a nice default background image in the imageTag this can reduce the "flash"

@dwa012

I followed the documentation and haf the ImageLoader in the Application class as a static object. I also referenced the demo project that is posted.

The images I am using are about 50KB each. I have about 20 of them loaded into the manager. I think that should be an acceptable amount of memory. I am seeing this issue on my Galaxy Nexus and the emulator.

The app is still in development. I can send a link if needed.

@luigi-agosti

if you have time will be great if you try to reproduce the issue in the demo project
maybe you can do something like :
1- copy one of the activity in the demo project
2- add a button or an option in the settings of the activity to trigger a notifyDataChanged
3- reproduce the update of the results of the list as you are doing it in your app

If the problem is affecting the demo project, make a pull request with a reference to this issue and I will look at it

@dwa012

Will do

@luigi-agosti

thanks :)

@luigi-agosti

ok I can see what you mean
I'm not completely sure I can improve that
the list is redraw and the image loader need to load the images once again

I will have a look if I can do something like skipping the loading of the background image if the image is in cache
But I need to investigate a bit ...

@dwa012
@ouchadam ouchadam was assigned
@rciovati

I'm having the same problem using an "endless" adapter.
@dwa012 have you found any workaround?

@dwa012

I have found a solution of sorts. I managed to get the image loader from the Google IO 2012 app to work. The loader in there does not have the flashing problem. I have been extremely busy and have not had a chance to try to merge the IO code with this project. I have linked the important parts below, in case someone else wishes to merge the code.

Usage:
http://pastebin.com/VxUL4ZMw

Link to source to include:
https://www.dropbox.com/s/i71deram4af69fe/Image%20loader.zip

If no one picks it up, I may try to get it merged in after a few weeks, when I can get some free time.

@friedger friedger referenced this issue from a commit
@friedger friedger more work on #54 8f17303
@ouchadam
Collaborator

8d0ca0b should fix the issue! Needs some more testing but notifydatasetchanged no longer causes a flash in the demo app at least

@ouchadam ouchadam closed this
@dwa012

Sounds good. I will try to give it a shot in the next few days. Thanks for the hard work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.