public void undoTurn() { this.mScores[gameState] -= addedSquares.size(); this.gameState = lastGameState; this.lines.remove(addedLine); drawer.removeLine(addedLine); for (Square s : addedSquares) { squares.remove(s); } drawer.removeSquares(addedSquares); addedSquares = new ArrayList<Square>(); // disable the undo button ((Button) findViewById(R.id.undoButton)).setEnabled(false); updateView(); }