@Override
    protected void onPostExecute(Void v) {
      xL.setText("X Linear Regression: " + lEQX.toString());
      xQ.setText("X Quadratic Regression: " + qEQX.toString());
      yL.setText("Y Linear Regression: " + lEQY.toString());
      yQ.setText("Y Quadratic Regression: " + qEQY.toString());
      zL.setText("Z Linear Regression: " + lEQZ.toString());
      zQ.setText("Z Quadratic Regression: " + qEQZ.toString());

      if (showDialog && dialog != null && dialog.isShowing()) dialog.dismiss();
    }
  private void solve(
      TextView tv,
      Spinner regressionType,
      EditText input,
      Vector<Double> time,
      Vector<Double> data) {
    DecimalFormat df = new DecimalFormat("0.000000");

    if (!input.getText().toString().equals("")) {
      switch (tv.getId()) {
        case R.id.xOutput:
          switch (regressionType.getSelectedItemPosition()) {
            case 0:
              tv.setText(df.format(lEQX.valueAt(Double.parseDouble(input.getText().toString()))));
              break;
            case 1:
              tv.setText(df.format(qEQX.valueAt(Double.parseDouble(input.getText().toString()))));
              break;
          }
          break;
        case R.id.yOutput:
          switch (regressionType.getSelectedItemPosition()) {
            case 0:
              tv.setText(df.format(lEQY.valueAt(Double.parseDouble(input.getText().toString()))));
              break;
            case 1:
              tv.setText(df.format(qEQY.valueAt(Double.parseDouble(input.getText().toString()))));
              break;
          }
          break;
        case R.id.zOutput:
          switch (regressionType.getSelectedItemPosition()) {
            case 0:
              tv.setText(df.format(lEQZ.valueAt(Double.parseDouble(input.getText().toString()))));
              break;
            case 1:
              tv.setText(df.format(qEQZ.valueAt(Double.parseDouble(input.getText().toString()))));
              break;
          }
          break;
      }
    } else {
      Toast.makeText(this, "Invalid Input", Toast.LENGTH_LONG).show();
    }
  }