title: How to Handle the Handler in SeekBar
body: <p>i am developing Call recording application. i am managed to show the audio files in ListView and able to play in MediaPlayer. know i am having a problem in SeekBar Handler. when i play the audio file, the MediaPlayer and SeekBar works absolutely right but when i close my application the Handler of SeekBar remains active. how can i stop the Handler. </p>
  
  <pre><code>private void playSong(String string)
                  throws IllegalArgumentException, SecurityException,
                  IllegalStateException, IOException {
  
              // seekBar
              setContentView(R.layout.dialog_activity);
              startButton = (Button) findViewById(R.id.play_button);
              stopButton = (Button) findViewById(R.id.pause_button);
              seekBar = (SeekBar) findViewById(R.id.seek_bar);
              startButton.setOnClickListener(MainActivity.this);
              stopButton.setOnClickListener(MainActivity.this);
  
              // MediaPlayer
              mp.reset();
              mp.setAudioStreamType(AudioManager.STREAM_MUSIC);
              mp.setDataSource(string);
              mp.prepare();
              mp.start();
              seekBar.setMax(mp.getDuration());
  
              try {
                  seekUpdation();
              } catch (Exception e) {
                  Toast.makeText(MainActivity.this,
                          "SeekUpdation " + e.toString(), Toast.LENGTH_SHORT)
                          .show();
              }
  
          }
  
          Runnable run = new Runnable() {
              @Override
              public void run() {
                  try {
                      seekUpdation();
                  } catch (Exception e) {
                      Log.d("Runnable ", "error in Runnable =" + e.toString());
                  }
              }
          };
  </code></pre>
  
  <p>thats the Handler who remain active after closing the application.</p>
  
  <pre><code>        public void seekUpdation() {
  
              seekBar.setProgress(mp.getCurrentPosition());
              seekHandler.postDelayed(run, 1000);
  
              Toast.makeText(MainActivity.this, "Uploaded" + seekHandler,
                      Toast.LENGTH_SHORT).show();
          }
  
      });
  }
  </code></pre>