I have created an object of AnimationDrawable with Bitmap frames. Next what I want to do is, to perform a function every time the Frame changes in that Animation. But I have no idea how I will be able to achieve this.
Is there any inbuilt or custom method available through which we can get triggered for frame change? Please help!
To create and start the Animation, I have used code as below:
int duration = 200;
Animation myAnim = new AnimationDrawable();
for (Bitmap frame : framesList) {
myAnim.addFrame(new BitmapDrawable(frame), duration);
}
if (android.os.Build.VERSION.SDK_INT <=
android.os.Build.VERSION_CODES.JELLY_BEAN)
imgPicture.setBackgroundDrawable(myAnim);
else
imgPicture.setBackground(myAnim);
myAnim.start();