I am making a simple tic tac toe game and I want to immediately print the X's and O's when a player presses a button. Just like how you could flush a print statement and immediately have the buffer empty itself without having to go through the whole program.
// method to print X's and O's on buttons
private void setText(Button btn) {
if (btn.getText().toString().equals("")) { // if button NOT toggled yet
if (state == 0) { // print 0 on button
btn.setText("0");
moves++;
state = 1;
} else { // print X on button
btn.setText("X");
moves++;
state = 0;
}
}
}