i 'm rotating image with runnable.i want to rotate image for example 4 th time and then pause/stop rotate.i wrote some function
public void rotateImage(final View myView, final int size) {
runnable = new Runnable() {
@Override
public void run() {
count++;
myView.setRotation(myView.getRotation() + size);
if (count ==3) {
myHandler.removeCallbacks(runnable);
}
myHandler.postDelayed(this, 100);
// 1000 means 1 second duration
}
};
myHandler.postDelayed(runnable, 100);
}
i can rotate image but i can't stop/pause rotating .removeCallbacks not working at the moment what is a wrong in my code if anyone knows solution please help me