i'm creating a sudoku puzzle, I used a tiledlayer called 'board' which represent the puzzle.
I applied the keyPressed method below to read the numbers entered by the user and place them
to the appropriate place in the board. the program works fine in the Sun WTK emulator, But when i install the application in my mobile phone i found that when i press:
- '2': number 2 prints in the correct position then the cursor moves one position to the top.
- '4': number 4 printed in the correct position then the cursor moved one position to the left.
- '6': number 6 printed and cursor moved one position to the right.
- '8': number 8 printed and cursor moved one position down.
- anyother number: the program behaves correctly.
protected void keyPressed(int keyCode)
String keyText = getKeyName(keyCode);
int keyNumber = Integer.parseInt(keyText);
int value = board.getCell(positionX, positionY);
board.setCell(positionX, positionY, keyNumber);
Basically i don't have any problem to move around the board, i'm using the mobile phone's joystick to move from one cell to another, so i want to disable the functionality of movements used by the numbers '2,4,6,8' and use them only for input like the other buttons '1,3,7,9'.
is there anyway how to do it? because i found other sudoku mobile games on the internet they use the same concept, the mobile phone joystick is used to move between cells, and the numbers '1,2,...9' are used for board input only.
Please do you know any solution for this problem?