title: How to stop handler.postDelayed in for-loop?
body: <p>I saw no real answer for this type of using "handler.posDelayed".</p>
  
  <p>So, I execute "handler.posDelayed" multiple times with a for-loop. The problem is, when I leave the activity and restart it, the new objects AND the old ones from the handler are executed too. I don't know, how to stop the old objects from the handler.</p>
  
  <pre><code>        private Handler handler = new Handler();
  
          private void startHandler() {
  
              handler.removeCallbacksAndMessages(runnable); // DOESN'T WORK
  
              long time = 0;
              for(int i = 0; i &lt; balls.length; i++){
                  handler.postDelayed(runnable, time + i);
              }
          }
  
          private Runnable runnable = new Runnable() {
              @Override
              public void run() {
                  // Some code..
              }
          };
  </code></pre>