public void onClick() { if(condition == true) { return; } string.setText("This string should not change if condition = true"); }