Back to project page android-tic-tac-toe.
The source code is released under:
MIT License
If you think the Android project android-tic-tac-toe listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package org.shaon.android.tictactoe.activity; // w w w . j a v a 2 s . c o m import static org.shaon.android.tictactoe.model.State.COLUMNS; import static org.shaon.android.tictactoe.model.State.ROWS; import org.shaon.android.tictactoe.R; import org.shaon.android.tictactoe.board.Board; import org.shaon.android.tictactoe.board.Cell; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; public class TicTacToeActivity extends Activity { private Board board; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); board = new Board(this); assignCellOnClickListener(); } private void assignCellOnClickListener() { for (int i = 0; i < ROWS; i++) { for (int j = 0; j < COLUMNS; j++) { Cell cell = board.getCell(i, j); findViewById(cell.getCellId()).setOnClickListener(board.getCell(i, j)); } } } /** * On click method for Reset button * * @param view Associated view object */ public void resetButtonClicked(View view) { board.initialize(); } /** * On click method for Settings button * * @param view Associated view object */ public void settingsButtonClicked(View view) { //TODO need to make it startActivityForResult() Intent intent = new Intent(this, SettingsActivity.class); startActivity(intent); } }