title: How does one let a code run after certain amount of time in java
body: <pre><code>    @Override
  protected void onDraw(Canvas canvas) {
      //Drawing the background and sprites as it is a blackboard.
      canvas.drawBitmap(scaledbmp, 0, 0, null);
      sprite.onDraw(canvas);
      boolean new_missle = true;
      missileStartTime = System.nanoTime();
  
      for (int i = missleslist.size() - 1; i &gt;= 0; i--) {
          if (new_missle) {
              missleslist.get(i).onDraw(canvas);
              new_missle = false;
          }
          if (!new_missle &amp;&amp; (missileStartTime - System.nanoTime()) == 1000000){
              new_missle = true;
              missileStartTime = System.nanoTime();
          }
      }
  }
  </code></pre>
  
  <p>Hello there, i posted my code first. What i'm trying to do here is drawing missles on a board, but not drawing them all at the same time and draw them seperatly after x milli/micro seconds. Anyhow this code does not work and i don't see why.</p>
  
  <p>Kees</p>