I have to start runnable on start button click and stop it on pause button click. My code for start runnable on start button click is
// TODO Auto-gener
Thread thread;
//inside start button
thread=new Thread(new Runnable() {
@Override
public void run() {
sec += 1;
if(sec >= 60) {
sec = 0;
min += 1;
if (min >= 60) {
min = 0;
hour += 1;
}
}
Min_txtvw.setText(String.format(mTimeFormat, hour, min, sec));
mHandler.postDelayed(mUpdateTime, 1000);
});
thread.start();
//inside stop button
mHandler.removeCallbacksAndMessages(runnable);
thread.stop();