I have implemented "New Game" and "Exit" button today.
It can pop out "Difficulty" dialog box as the same way as I did for "About" button. The game is not started since it has only an entry point and it is supposed to print a message on the screen.
2 problems I encountered:
- It did not show the message "clicked on ... " as the book said.
Click Window->ShowView->LogCat
See image below.
At the end, I would recommend you save the directory (whole package) after each feature worked then start modifying files for the new feature.
In general, there is labeling mechanism in source code control system. I do not know if Eclipse has the feature. If you know, please let me know.
- It did not exit the game by pressing "Exit" button.
Page 56-57 of Hello, Android
In Sudoku2.java
In Sudoku2.java
private void startGame(int i) {
Log.d(TAG, "clicked on " + i); // This prints nothing (?) See LogCat window
// Start game here
}
case R.id.exit_button:
finish(); // Did not exit the program (?)
break;
case R.id.exit_button:
finish(); // Did not exit the program (?)
break;
New Game Dialog is implemented |
LogCat Window for Log.d output |
In general, there is labeling mechanism in source code control system. I do not know if Eclipse has the feature. If you know, please let me know.