You can define a boolean and change it to false when you want to stop handler. Like this..
boolean stop = false;
handler.postDelayed(new Runnable() {
@Override
public void run() {
//do your work here..
if (!stop) {
handler.postDelayed(this, delay);
}
}
}, delay);