@Override
 public void surfaceDestroyed(SurfaceHolder holder) {
   Log.d(TAG, "Surface is being destroyed");
   // tell the thread to shut down and wait for it to finish
   // this is a clean shutdown
   boolean retry = true;
   while (retry) {
     try {
       thread.join();
       retry = false;
     } catch (InterruptedException e) {
       // try again shutting down the thread
     }
   }
   Log.d(TAG, "Thread was shut down cleanly");
 }
Beispiel #2
0
  @Override
  public void surfaceDestroyed(SurfaceHolder holder) {
    boolean retry = true;
    int counter = 0;
    while (retry && counter < 1000) {
      counter++;
      try {
        thread.setRunning(false);
        thread.join();
        retry = false;
        thread = null;

      } catch (InterruptedException e) {
        e.printStackTrace();
      }
    }
  }