Example #1
0
 // 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();
   }
 }
Example #2
0
 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) {
     }
   }
 }