@Override
  public void surfaceDestroyed(SurfaceHolder holder) {
    boolean retry = true;
    plot_thread.setRunning(false);
    while (retry) {
      try {
        plot_thread.join();
        retry = false;
      } catch (InterruptedException e) {

      }
    }
  }
 @Override
 public void surfaceCreated(SurfaceHolder holder) {
   plot_thread.setRunning(true);
   plot_thread.start();
 }