title: Android: SurfaceView ignoring postInvalidate()?
body: <p>It's the first time I'm using this so I'm not sure whether its a bug in my code or I'm trying to do something thats not allowed.</p>
  
  <p>Currently, I have a DrawThread() which does this in the run method.</p>
  
  <pre><code>try {
    c = m_surfaceHolder.lockCanvas(null);
    synchronized (m_surfaceHolder) {
      m_view.onDraw(c);
    }
  }
  finally {
    if (c != null) {
      m_surfaceHolder.unlockCanvasAndPost(c);
    }
  }
  </code></pre>
  
  <p>While in this drawing thread (non UI-thread), my onDraw() method passes the canvas along to another method called drawScoreboard(). I wanted this method to have a short delay between displaying each row of the scoreboard, so I added a postInvalidateDelay(x) hoping it would trigger onDraw() again.</p>
  
  <pre><code>/**
   * A helper function which draws the scoreboard.
   */
  private void drawScoreboard(Canvas canvas) {
    long delay = m_drawScoreboard.draw(canvas, m_paint);
  
    if (delay &gt; 0) {
      this.postInvalidateDelayed(delay);
    }
  }
  </code></pre>
  
  <p>The code executes correctly and postInvalidateDelayed() IS being called, but I'm baffled to why onDraw() is not being called. Are there any flags or initialisation I need to do in order to get this to work?</p>
  
  <p>Any advice or theories are welcome.
  Thanks!</p>