Hope you all are well.
I would like to hide a Button (btnAppointment) if my test readings in my EditText are below or equal 13.5 or greater than 33 in my Android Application window. The Button (btnAppointment) should only appear on the screen if my EditText field inputted values are between 13.60 and 32.99. And not be shown onscreen if outside these parameters.
I was wondering whether an IF statement with button.setEnabled(false);
would do the trick and if so where about would I need to input it into my Code. Whether it be protected void onCreate(Bundle savedInstanceState)
or Create my own public void appointmentTeacherOnClick
?
Below I have inserted my code for calculating and displaying my Inputted Test field prompts.
public void calculateTest(View v){
String status;
test = Double.parseDouble(edtData.getText().toString());
String result = String.format("%.2f", test);
Log.d("MyActivity", result);
if( test < 9.5) {
status = "Normal - Well Done =)";
} else if (test >= 9.5 && test < 13.5){
status = "Caution - Keep on Track =|";
} else if (test >= 13.5 && test < 33.0) {
status ="Action Needed =(";
} else {
status = "Normal Results are between 0 - 33";
}
AlertDialog alertDialog = new AlertDialog.Builder(this).create();
alertDialog.setTitle("Result Feedback...");
alertDialog.setMessage(status);
alertDialog.setButton("Acknowledged", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
}
});
alertDialog.show();