title: Why isn't view.invalidate immediately redrawing the screen in my android game
body: <p>I am trying to make an android game.</p>
  
  <p>I have a game class that extends activity and handles all the user input.  Then I have a missionView class that extends view and it draws the level on the screen.</p>
  
  <p>When the user clicks on a door I want to add some animation.</p>
  
  <p>What happens is:  The game calls door.open.  Changes the state so the view.onDraw function will draw the door half open.  The game calls view.invalidate, which should redraw the screen.  Then the game sleeps for half a second.  Then it calls door.open again.  The second time the function is called it changes the state so the view.onDraw function draws the door completely open.  Then the game calls view.invalidate again.</p>
  
  <p>The problem is that it does not redraw the screen when it gets to view.invalidate.  If I set a break point on the line and run the debugger and click step into it does not step into my view.onDraw function.  It can't even show me the code it is executing.</p>
  
  <p>What I have is:
  Door class:</p>
  
  <pre><code>public boolean open()
  {
     if (doorState == DoorState.Closed)
     {
         doorState = DoorState.Opening;
  
         return true;
     }
     else if (doorState == DoorState.Opening)
     {
          doorState = doorState.Open;
          return true;
     }
     else
     {
        return false;
     }
  }
  </code></pre>
  
  <p>Game class:</p>
  
  <pre><code>if (tile instanceof DoorTile)
  {
      DoorTile doorTile = (DoorTile) tile;
      Door door = doorTile.getDoor();
  
      if (door.isClosed())
      {
          door.open();
          selectedEntity.openDoor();
          view.invalidate();    // This line does not work
  
          try 
          {
              Thread.sleep(500);
          } 
          catch (InterruptedException e1) 
          {
               // TODO Auto-generated catch block
               e1.printStackTrace();
          }
          door.open();
  
          // Handled touch event so break switch statement
          break;
       }
  }
  </code></pre>