I've implemented an AnimationDrawable that cycles through 6 image frames.
Here's how I'm initializing the animation:
animation = new AnimationDrawable();
// images is an ArrayList<BitmapDrawable>
for (Bitmap image : images) {
BitmapDrawable drawable = new BitmapDrawable(mActivity.getResources(), image);
animation.addFrame(drawable, 200);
}
animation.setOneShot(false);
ImageView imageView = (ImageView) findViewById(R.id.backgroundImage);
imageView.setImageDrawable(animation);
// Starter implements Runnable and calls animation.start
imageView.post(new Starter());
When I run this code, the animation begins cycling through the list of 6 image frames (duration 200 ms each). The issue that I see is that, as it's cycling through images, it will start flickering and showing one of the frames like it's the background image. On each frame.
Might be a bit confusing, so I'll see if I can describe it...can't post a video since there's sensitive information there.
Let's say the 6 images are fish, grass, dog, cat, pizza, apple. The animation should cycle through those images at 200 ms per frame. What I see is that the currently displayed frame will disappear and the pizza frame will show up for 50-100ms and disappear, switching back to the frame that should be displayed. Every frame.
I've tested on 5.0 and 4.1.1 devices and haven't seen this issue until now (4.4.4). Anyone have an idea on what could be going wrong?
Thanks!
UPDATE I've now tested on a Samsung Galaxy S4 running 4.4.4 and have NOT seen this issue. Possibly related to Motorola hardware?