Ever wondered why LunarLander sample crushes on loosing focus (for example, when receiving a phone call)?
That "feature" bugged me for few hours, until I gave up and googled similar questions on stackoverflow.com.
It turned out that fix was very small, here is the code I've used in Gomoku Master:
@Override
public void surfaceCreated( SurfaceHolder holder ) {
if ( fThread.getState() == Thread.State.TERMINATED ) {
fThread = new DrawThread( getHolder(), FiveInARow.getContext() );
}
fThread.setRunning( true );
fThread.start();
fThread.draw();
} |
Java2html |