I am attempting to write an android game involving a class which extends SurfaceView and implements SurfaceHolder.CallBack. The class then creates its own thread which may need to be paused/unpaused appropriately. I wanted to use the example Lunar Landeras a reference, but this seems not to implement all sorts of essential things and it will occasionally crash on my phone.
What I am looking for is the simplest possible game which employs SurfaceView’s, SurfaceHolder.CallBack’s Threads and clearly handles all the game lifecycle events like onPause, onStop, onRestart etc – and without ever crashing.
Does such an example game exist?
There are some simple game examples on apps-for-android. Check SpriteMethodTest for example, which shows the basic structure of a good android game (what threads to create, how they communicate, how to draw efficiently (the app itself is a benchmark), …). It implements both
SurfaceViewandGLSurfaceViewand shows different ways to draw on these surfaces.