-4

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.

idleberg
  • 12,634
  • 7
  • 43
  • 70
Taylor
  • 1
  • Try searching for a tutorial online, something like this: https://stackoverflow.com/questions/11154898/android-programmatically-setting-button-text – Mr-IDE Jan 22 '18 at 21:28
  • This question is unrelated to the Atom editor, so there's no need to add a tag for it. – idleberg Jan 23 '18 at 13:29

1 Answers1

0

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
            }
        });
Rizwan Atta
  • 3,222
  • 2
  • 19
  • 31