Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Well I've finnaly decided to start Android game dev, and my first project will be simple 2d canvas based game. I have some experience in game developing with C# and XNA, and I'm a bit confused now. Back in XNA we have Game class with Initialize, Update and Draw methods.

In Android I have to extend SurfaceView class, run draw and update in their own thread, and receive touch input from user.

I'm looking for a proper way to structure my code.

Some of my questions are :

  • How to deal with Activities (Should I run everything in one activity, or split whole game in 2 or more) ?
  • Where should I run game loop ?
  • Where to put Draw and Update methods ?
  • How to respond to touch events ?

Hope I came to the right place for answers...

share|improve this question
I suggest you want to look at LibGDX. Just like XNA it's a library for games. It has a pretty big community and lots of documentations. – Sidar Jan 6 '13 at 4:20
Well, I'll give it a try sometime. – Nikola Ninkovic Jan 6 '13 at 10:13
up vote 2 down vote accepted

A minimal Breakout game, demonstrating the use of Activities, touch event handling, and draw/update with GLSurfaceView can be found here:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.