I have a activity,my activity contains ImageView and two buttons.I have assign drawable animation to ImageView.when u click on next button animation will be change before animation change just i clear drawable animation frames using following code,
loadingAnimation.stop();//drawable animation object
for (int i = 0; i < loadingAnimation.getNumberOfFrames(); ++i){
Drawable frame = loadingAnimation.getFrame(i);
if (frame instanceof BitmapDrawable) {
((BitmapDrawable)frame).getBitmap().recycle();
}
frame.setCallback(null);
}
loadingAnimation.setCallback(null);
It is working fine for Next Button.we move A1(animation1) to A2(animation2) just click on next button.if we want move back to A2 to A1 just click on previous button.When u click on previous button for move back to A2 to A1 i got exception like,
Canvas: trying to use a recycled bitmap android.graphics.Bitmap
please help me..
Something like this atleast, maybe you need to change it to fit your code perfectly.