public void surfaceDestroyed(SurfaceHolder holder) {
   boolean retry = true;
   thread.setRunning(false);
   while (retry) {
     try {
       thread.join();
       retry = false;
     } catch (InterruptedException e) {
     }
   }
 }
  public boolean onTouchEvent(MotionEvent event) {

    if (event.getAction() == MotionEvent.ACTION_DOWN) {
      if (event.getY() > getHeight() - 50) {
        thread.setRunning(false);
        ((Activity) getContext()).finish();
      } else {
        thread.world.UseTurb();
      }
    }

    return super.onTouchEvent(event);
  }
 public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
   thread.setSurfaceSize(width, height);
 }
 public void surfaceCreated(SurfaceHolder holder) {
   thread = new DoodleThread(new Handler());
   thread.setRunning(true);
   thread.start();
 }