@SuppressWarnings("deprecation")
  @Override
  public void onResume() {
    super.onResume();
    if (getIntent().getExtras() != null && getLastNonConfigurationInstance() == null) {
      try {
        dp = FileUtilities.readAccelerationData(getIntent().getExtras().getString("FILENAME"));
      } catch (IOException e) {
        Toast.makeText(this, "Error reading file.", Toast.LENGTH_LONG).show();
        e.printStackTrace();
      } catch (BadDataException e) {
        Toast.makeText(this, "Invalid Data Format.", Toast.LENGTH_LONG).show();
        e.printStackTrace();
      }

      setTitle(dp.getTitle() + " - Info Page");
    }

    final Spinner regressionTypesX = (Spinner) findViewById(R.id.typeOfRegressionX),
        regressionTypesY = (Spinner) findViewById(R.id.typeOfRegressionY),
        regressionTypesZ = (Spinner) findViewById(R.id.typeOfRegressionZ);

    final String[] entriesRegressionTypes = {"Linear", "Quadratic"};
    ArrayAdapter<String> regressionTypesArrayAdapter =
        new ArrayAdapter<>(
            this, android.R.layout.simple_spinner_dropdown_item, entriesRegressionTypes);

    regressionTypesX.setAdapter(regressionTypesArrayAdapter);
    regressionTypesY.setAdapter(regressionTypesArrayAdapter);
    regressionTypesZ.setAdapter(regressionTypesArrayAdapter);

    Button xCalc = (Button) findViewById(R.id.calculateXButton),
        yCalc = (Button) findViewById(R.id.calculateYButton),
        zCalc = (Button) findViewById(R.id.calculateZButton);

    final EditText xInput = (EditText) findViewById(R.id.xInput),
        yInput = (EditText) findViewById(R.id.yInput),
        zInput = (EditText) findViewById(R.id.zInput);

    lEQX = new LinearEqn(dp.getTime(), dp.getX());
    qEQX = new QuadEqn(dp.getTime(), dp.getX());

    lEQY = new LinearEqn(dp.getTime(), dp.getY());
    qEQY = new QuadEqn(dp.getTime(), dp.getY());

    lEQZ = new LinearEqn(dp.getTime(), dp.getZ());
    qEQZ = new QuadEqn(dp.getTime(), dp.getZ());

    final TextView xOutput = (TextView) findViewById(R.id.xOutput);
    final TextView yOutput = (TextView) findViewById(R.id.yOutput);
    final TextView zOutput = (TextView) findViewById(R.id.zOutput);

    xCalc.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {

            solve(xOutput, regressionTypesX, xInput, dp.getTime(), dp.getX());
          }
        });

    yCalc.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {

            solve(yOutput, regressionTypesY, yInput, dp.getTime(), dp.getY());
          }
        });

    zCalc.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {

            solve(zOutput, regressionTypesZ, zInput, dp.getTime(), dp.getZ());
          }
        });

    regressionTypesX.setOnItemSelectedListener(this);
    regressionTypesY.setOnItemSelectedListener(this);
    regressionTypesZ.setOnItemSelectedListener(this);

    loadData =
        new LoadData(
            dp,
            this,
            new TextView[] {
              (TextView) findViewById(R.id.xLinearEqn),
              (TextView) findViewById(R.id.xQuadEqn),
              (TextView) findViewById(R.id.yLinearEqn),
              (TextView) findViewById(R.id.yQuadEqn),
              (TextView) findViewById(R.id.zLinearEqn),
              (TextView) findViewById(R.id.zQuadEqn)
            },
            new LinearEqn[] {lEQX, lEQY, lEQZ},
            new QuadEqn[] {qEQX, qEQY, qEQZ},
            true);

    loadData.execute((Void[]) null);
  }
    @Override
    protected Void doInBackground(Void... arg0) {
      lEQX = new LinearEqn(dp.getTime(), dp.getX());
      qEQX = new QuadEqn(dp.getTime(), dp.getX());

      lEQY = new LinearEqn(dp.getTime(), dp.getY());
      qEQY = new QuadEqn(dp.getTime(), dp.getY());

      lEQZ = new LinearEqn(dp.getTime(), dp.getZ());
      qEQZ = new QuadEqn(dp.getTime(), dp.getZ());
      return null;
    }