// must implement inherited abstract methods public void surfaceCreated(SurfaceHolder holder) { // Create the thread if (!myThread.isAlive()) { myThread = new GameThread(getHolder(), this); myThread.startRun(true); myThread.start(); } }
public void surfaceDestroyed(SurfaceHolder holder) { // Destroy the thread if (myThread.isAlive()) { myThread.startRun(false); } boolean retry = true; while (retry) { try { myThread.join(); retry = false; } catch (InterruptedException e) { } } }