@Override public void onClick(View src) { switch (src.getId()) { case R.id.btnCalc: retrieveSuvat(); if (LogOn) Log.d("SUVAT resolver", "The user has entered " + varCount + " variables."); if (varCount >= 4) { // in case it is 4 or 5 variables entered showDialog(DIALOG_TOOMANYNUMS_ID); if (LogOn) Log.d("SUVAT resolver", "More than 3 variables entered!"); return; } else if (varCount < 3) { // less than 3 variables entered showDialog(DIALOG_LACKNUMSENTERED_ID); if (LogOn) Log.d("SUVAT resolver", "Less than 3 variables entered!"); return; } else if (varCount == 3) { // all is well, 3 variables entered // reconstruct the suvat particle suvat = new Suvat(values, flags); // resolve the values suvat.resolve(); // update screen values updateTxtValuesFromSuvat(); // clear suvat object suvat = new Suvat(); } break; case R.id.btnClear: // clear the suvat object suvat = new Suvat(); // clear the text in the text boxes clearTextBoxes(); break; } }
private void updateTxtValuesFromSuvat() { try { txtS.setText(suvat.isSet('s') ? format.format(suvat.retrieve('s')) : ""); txtU.setText(suvat.isSet('u') ? format.format(suvat.retrieve('u')) : ""); txtV.setText(suvat.isSet('v') ? format.format(suvat.retrieve('v')) : ""); txtA.setText(suvat.isSet('a') ? format.format(suvat.retrieve('a')) : ""); txtT.setText(suvat.isSet('t') ? format.format(suvat.retrieve('t')) : ""); } catch (Exception e) { if (LogOn) Log.d(DBG_NAME, "Incorrect suvat char parameter passed!"); } }