title: Is it possible to manually destroy SurfaceView?
body: <p>My SurfaceView is not getting destroyed even if onPause of the activity is called.</p>
  
  <p>I am taking care of the thread in </p>
  
  <pre><code>public void surfaceCreated(SurfaceHolder holder) {
      if (mGameThread.getState() == Thread.State.TERMINATED) {
          createGameThread(getHolder(), getContext());
      }
      mGameThread.setRunning(true);
      mGameThread.start();
  }
  
  
  public void surfaceDestroyed(SurfaceHolder holder) {
      boolean retry = true;
      mGameThread.setRunning(false);
      while (retry) {
          try {
              mGameThread.join();
              retry = false;
          } catch (InterruptedException e) {
          }
      }
  }
  </code></pre>
  
  <p>As an hack I have to check the state of the thread in onResume and if the thread is already  terminated, I would finish the activity</p>
  
  <pre><code>protected void onResume() {
      Log.d(mLogTag, "onResume()");
      super.onResume();
      if (mGameThread != null) {
          if (mGameThread.getState() == Thread.State.TERMINATED) {
              finish();
          }
      }
  
  }
  </code></pre>
  
  <p>Unfortunately it is not possible to move the thread handling from surfaceDestroyed and surfaceCreated to onPause() and onResume() of the activity. Is it possible to manually destroy the SurfaceView in the onPause() and recreate it in onResume()?</p>