There is a method in Java known as
void setActionCommand() and the complementary being
String getActionCommand() to get customized text from JButton / Button (default being text of the button itself).
Now I have switched to android, and converting an app from Java to Android. Is there any method in Android API which does the same thing with the android button, i.e. which can set and get a customized text for a button ?
Thanks !
EDIT : For Non- Swing API / Core Android people:
There are two methods associated with a swing button (JButton)
1. void setText(String s);
2. String getText();
and when an event occurs on a button, we take the command using object of ActionEvent (Event Listener class) using this method
ActionEventObject.getActionCommand()
we also have a method to set this command called setActionCommand(String) which can be called from a button reference Eg.
button1.setText("Option");
button1.setActionCommand("Android");
Now even if button1's text is "Option", in event handling procedure the button can be identified by the string ("Android"). Moreover, the text "Option" is visible to the user while "Android" is not visible to the user and is used for event handling procedures only.