I'm developing an android application, I want a button to appear with the button text being whatever the user inputs into a text field. Confused on how to achieve this.
2
-
Try searching for a tutorial online, something like this: stackoverflow.com/questions/11154898/…Mr-IDE– Mr-IDE2018-01-22 21:28:51 +00:00Commented Jan 22, 2018 at 21:28
-
This question is unrelated to the Atom editor, so there's no need to add a tag for it.idleberg– idleberg2018-01-23 13:29:58 +00:00Commented Jan 23, 2018 at 13:29
Add a comment
|
1 Answer
lets take an example that you have two buttons defined in the xml one to click on and one to appear later. make the second button invisible using the android:visibilty=invisible and then in the click listener of the first button do something like this.
yourbtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String incomingText = yourEditText.getText().toString();
invisibleButton.setText(incomingText);
invisibleButton.setVisibility = View.VISIBLE
}
});