I am working on a small app and i have been working on the finishing touches but have encountered a logic problem i cannot seem to solve.
I have a function:
public void quitOrStartGame(View view){
Button quitStart = (Button)findViewById(R.id.quit_startButton);
Button reset = (Button)findViewById(R.id.resetButton);
reset.setClickable(false);
if (quitStart.getText() == "Quit") {
gridGame.quit();
importGrid();
quitStart.setText("Start");
reset.setClickable(false);
}
else {
gridGame.startGame();
importGrid();
quitStart.setText("Quit");
reset.setClickable(true);
}
}
That is designed to start up my game. It is a 5x5 game with x's and o's for an assignment, its not really important what the assignment is for my problem.
What i am attempting to accomplish is in the beginning when you first open the app you see two buttons, one that says reset, and one that says start. When you press start it starts the game and the button changes to a quit button, which will stop the game from running.
The thing is, i do not want the reset button to be clickable until after the start button has been pressed, which currently does not happen. The reset button does its normal function before start is even pressed.
HOWEVER: When you do press start, and then eventually quit, this does disable the reset button, but that process has to happen first. What i want is for the reset button to be disabled until start is pressed, and then be disabled again for the duration of the time after quit is pressed.
I hope i explained the problem well enough, thanks in advance for any help you fine folks can offer!