• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

How can I Clear EditText and Retain New Typing

I have a single EditText view. It normally has text in it that represents a number. I would like the user to be able to tap in the view and have the contents be cleared. Then the user puts in a new number and taps "Done" on the keyboard. The keyboard should go away and the EditText should retain the new value for future access.

If I just let the user tap in the EditText the "old" value will still be there and the user will have to delete it one character at a time before entering a new value. Then tap Done on the keyboard.

I tried an OnClick that:
This will clear all the text and allow the user to enter new text. But when the user is finished the user has to tap the "Done" button on the keyboard. When that happens the EditText is cleared again and the keyboard remains. There doesn't seem any way out of this state.

Any ideas?


We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.