title: How to stop Runnable on button click in Android?
body: <p>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</p>
  
  <pre><code>    // TODO Auto-generated method stub
      //while (running) {
       mUpdateTime = new Runnable() {
              public void run() { 
       sec += 1;
          if(sec &gt;= 60) {
              sec = 0;
              min += 1;
              if (min &gt;= 60) {
                  min = 0;
                  hour += 1;
              }
          }
          Min_txtvw.setText(String.format(mTimeFormat, hour, min, sec));
          mHandler.postDelayed(mUpdateTime, 1000);
              }
          };
          mHandler.postDelayed(mUpdateTime, 1000);
      //}
  </code></pre>
  
  <p>now i want to stop that runnable on pause button click </p>
  
  <p>pause_btn.setOnClickListener(new OnClickListener() {</p>
  
  <pre><code>        @Override
          public void onClick(View v) {
              // TODO Auto-generated method stub
              play_btn.setVisibility(View.VISIBLE);
              pause_btn.setVisibility(View.INVISIBLE);
  
          }
      });
  </code></pre>
  
  <p>How can i stop that runnable on pause button click if anyone knows please help me.</p>