I have an ImageButton that will show different drawables based on its state(pressed, etc) using selectors. I want play an frame by frame animation on this button on specified time intervals.
Here is the code:
ImageButton btn;
btn.setImageResource(R.drawable.my_anim);
AnimationDrawable ani = (AnimationDrawable)btn.getDrawable();
ani.start();
So the issue is that animation is played only once. And after animation is finished i want to reset the button so that it show different drawables based on its state using selectors. But this is not happening now. After the animation is finished, the selectors never worked again. Although btn onClick event is working.
So, how can i do the above?