I want to show ImageViews in a GridView using animation. I can display them and apply the animation correctly.
But the problem is that if I applied animation on ImageView1, and then on ImageView2 (before the animation on ImageView1 is completed), the animation on ImageView1 will be interrupted and ImageView1 will be directly set to the final state.
Please note that I am loading an image using ThreadPoolExecutor with two threads. Whenever the image is loaded, I call the addImage(image) method below the ImageAdapter , which in turn adds the image to the GridView , and the GridView updated to display the last set of images. And here, while rendering, a new image is displayed with animation, and this animation (I think) interrupts the animation of the animated images at present.
ImageAdapter:
public class ImageAdapter extends BaseAdapter { private Context mContext; private List<Bitmap> images; private ArrayList<Integer> colors; private boolean[] alreadyLoadedIndexes; Animation animation; AnimatorSet animator; public void addImage(Bitmap img) { images.add(img); notifyDataSetChanged(); } public void setAnimation(Animation animation) { this.animator = null; this.animation = animation; } public void setAnimator(AnimatorSet animation) { this.animation = null; this.animator = animation; } public void resetImages() { images.clear(); notifyDataSetChanged(); alreadyLoadedIndexes = null; alreadyLoadedIndexes = new boolean[20]; }
source share