title: Approach for Android game with timers and touch event (move) handling
body: <p>I'm doing a game with game loop and active rendering (using SurfaceView and SurfaceHolder.Callback).</p>
  
  <p>I'm wondering how to make that work together with timed events and touch event management.
  The timed events are like each xx ms something happens, each yy ms something different happens.
  Touch management is update game and screen when down, up, and move.</p>
  
  <p>I have made a few tries, but it looks somehow awkward and the game isnt performing very well..</p>
  
  <p>On one side I have a classic game loop (in separate thread):
  while running update, render, draw, sleep a bit</p>
  
  <p>Now I didn't know well how to make this work with timer loops. I used handler approach - make classes which extend handler, do what they have to do in handleMessage, and call then themselves with sendMessageDelayed.</p>
  
  <p>They just update game state. The rendering of the resulting changes would be done in the gameLoop.</p>
  
  <p>This approach needs synchronization for update of gameloop not intefering with update of the timers.</p>
  
  <p>And - besides of this I need to handle touch events - down, up, and move!
  My approach here was, like in the timers, just update game state, and leave it to the loop to handle and display correctly.</p>
  
  <p>I don't know if I'm maybe on the completly wrong path, noob to Androd, and made it just like i thought "could work".</p>
  
  <p>For example I'm not sure if its necessary to make a game loop in a separate thread. I thought it was, to show the results of touch handling (move) according to certain framerate.</p>
  
  <p>On the other side I could leave the loop and just tell to draw after each timer update, and after each touch handling, but this doesnt work well either.</p>
  
  <p>The question is what's the general approach for this kind of game? (timed loops / touch event (move) which has to render to screen continuosly).</p>
  
  <p>Thanks in advance.</p>