Whenever I presses the button, it should change text, and also change boolean value, yet this is not working. Any help? Thnks
Before onCreate:
public boolean status = false;
Button Click:
case R.id.saveButton:
if (status != true) {
currentStatus.setText("Current status: In need of help!");
status = true;
}
if (status != false) {
currentStatus.setText("Current status: Fine.");
status = false;
}
break;
Anurag Sharma
19-Nov-2014or using ternary operator :
currentStatus.setText(status ? "Current status: Fine." : "Current status: In need of help!");
status = !status;//toggle boolean value