I designed a user interface for a chess game by using buttons in a table layout. For the chess pieces I took the ASCII values and printed on the button as a string value. But I
If you just want the text value of the button, attach the following OnClickListener to all of your buttons:
OnClickListener myButtonClickListener = new OnClickListener() {
@Override
public void onClick(View v) {
String buttonText = ((Button) v).getText();
//Do whatever you want with buttonText
}
};
To assign it for the Button instance "myButton":
myButton.setOnClickListener(myButtonClickListener );