I am trying to create a word game, where all the letters in a word will be added to a grid layout and presented to the user. The user then has to form the word by clicking the letter buttons. The buttons will be disabled once pressed. If the user decides to reset the game, the same grid layout has to be presented again to the user with all the buttons enabled. Is there any function that can be used to set all the buttons as Clickable? Below is the code, I used.
for(final String letter : shuffled_word){
final Button button = new Button(this);
button.setText(letter);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
button.setClickable(false);
}
});
this.game_grid.addView(button);
}