Recently nothing to do, according to video Tutorial wrote a Sudoku game, very rough there are many places to modify. Let's talk about this game.
1. Customize a View control to display a 9*9 grid on the screen, which is actually a horizontal drawing of 8 lines, a vertical drawing of 8 jumpers, and then a few of the lines to be bold. So that's the 9*9 lattice.
2. Initialize the numbers on the game interface with a string
1 String str_int = "360000000004230800000004200" +2 "070460003820000014500013020" +3 "001900000007048300000000045"; // Data Initialization Data
I'm just going to fill in the initialized numbers with a string.
3. When clicking on a grid, we need to figure out the row of the lattice, the number that has appeared in the small 9, that is, the number that cannot be used, and then gives the user a number that can be used. (a bit around here) I used a custom dialog to show the user
4. The user clicks on the number above the dialog, recalculates the already used number, refreshes the interface, that is, calls back the OnDraw () method
SOURCE download
PS: Source code is a bit messy, the document is also very confusing
Android Sudoku Game