0
내가 안드로이드에서 여기에 초보자입니다, 나는 온라인 자습서 따르는하여 ticTacToe 게임에 대한 touchListener이 코드 블록에 문제가 있어요.오류 - 안드로이드
내가 점점 계속 오류는 다음과 같습니다
다음 코드는 MainActivity.java에 위치한
무효 & &가 인수 형식 (들) 부울에 대한 정의되지 운영자. 내가 정확하게 튜토리얼 http://www.harding.edu/fmccown/classes/comp475-s10/tic-tac-toe-graphics.pdf을 따랐다
public void setMove(char player, int location) {
if (location >= 0 && location < BOARD_SIZE &&
mBoard[location] == OPEN_SPOT) {
mBoard[location] = player;
}
}
:
// Listen for touches on the board
private OnTouchListener mTouchListener = new OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
// Determine which cell was touched
int col = (int) event.getX()/mBoardView.getBoardCellWidth();
int row = (int) event.getY()/mBoardView.getBoardCellHeight();
int pos = row * 3 + col;
if (!mGameOver && setMove(TicTacToeGame.HUMAN_PLAYER, pos)) { //*****************
// If no winner yet, let the computer make a move
int winner = mGame.checkForWinner();
if (winner == 0) {
mInfoTextView.setText(R.string.turn_computer);
setMove(TicTacToeGame.COMPUTER_PLAYER, pos);
winner = mGame.checkForWinner();
}
}
return false;
}
};
나는 setMove()가 TicTacToeGame.java에서 무효이므로이 생각 : 나는 라인에이 오류가 아래의 별 강조 얻을
나는 어떤 도움을 매우 감사하게 될 것입니다.
많은 감사,
베스 앤 당신이에 링크 된 PDF에서
내가 수정 한 setMove을()에 부울 : –
전용 부울 setMove (CHAR 플레이어 INT 위치) { 경우 (mGame.setMove (플레이어의 위치)) { mBoardView.invalidate(); // 보드 다시 그리기 return true; } false를 반환합니다. } –
여전히 작동하지 않습니다. –