Dynamically updating a GridView with animations

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Dynamically updating a GridView with animations

Postby soulybouly » Sat Jan 10, 2009 2:01 pm

Hallo board

First of, let me thank you for all the valuable information i have found here so far. I am currently investigating the android platform with my first more elaborate application (like so many of us are doing here :) ).

This leads me to a problem which i am currently facing: I am writing an application which fetches images from the internet and displays them in a a GridView. The loading process is executed multithreaded, so that i can fetch multiple images at the same time (using the concurrency Runnables and ExecutionService). I am displaying placeholders for the images in the grid while they are loading and would like to fade them in using an animation when they are loaded. Here is where the problem comes in:

When playing the fade-in animation, the animation gets cut of as soon as a new image is done loading and causes a refresh on the Adapter. Since i have to use an android.widget.BaseAdapter to provide the data to display in the GridView, the entire GridView gets refreshed when a new image is loaded and is about to be displayed. I use BaseAdapter.notifyDataSetChanged()to refresh the GridViews content. When an images is done loading it causes a refresh via the notify method and starts its fade animation. The animation playes fine but is immediately cut of when another image is done loading and invokes notifyDataSetChanged() itself causing a global view refresh. Naturally i don't want to display the animation everytime the GridView gets refreshed but only the very first time an image is displayed.

What i would need is to make the notifyDataSetChanged() not refresh the entire GridView but only insert/refresh the one new image, leaving the others in place and playing there animation. Maybe the GridView and its Adapter is not the right widget for my task though.

And help would be greatly appreciated and i am looking forward to participate on this board. :)
soulybouly
Once Poster
Once Poster
 
Posts: 1
Joined: Sat Jan 10, 2009 1:40 pm

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 1 guest