Reputation: 569
I have a TextView
with some default text, but when a particular file exists it should prompt the user for new text for the TextView. Is there a simple way to do this?
I know what the if statement should be, but not how to get the user response.
In JavaScript I would have done something like:
var newText = prompt("What should the new text be?");
myElement.text = newText;
Upvotes: 0
Views: 1346
Reputation: 33991
Use a Dialog
/DialogFragment
that includes an EditText
(and potentially some further validation) to get the user's input.
This Android-Developers blog post covers exactly this scenario and should answer all your questions.
Upvotes: 1