Skip to content
Advertisement

Naming Buttons through User Input

So I´m having three Buttons which lead to other Activities with a normal Click. Now i want to name the buttons through a longer Click and User Input. So short click goes forward, long Click ability to rename it. So far i was able to rename the button with a long click, but only to a predetermined String. My code so far.

JavaScript

Advertisement

Answer

Getting text user input can be accomplished by using the EditText class which can hold user input.

Once you have setup your EditText, you can use the user input in your naming function using getText().

  1. Define an EditText.
JavaScript
  1. Find the reference for the EditText.
JavaScript
  1. The user input is now available from the EditText object.
JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement