This question already has an answer here:
How do I delete one by one the current text of edit text when I press a button and continuously delete the text one by one when I hold the press of button. Similar to what a backspace button does.
Sending a backspace event won't work on my needs because it will only work if the keyboard is active. Im not using any keyboards.
You can send a BACKSPACEKEY EVENT to your EditText.
Here is the sample for what you want Send backspace key event to edit text.
Edit
Manually you can do like this
Get the String from
edittext
.Delete the char at last index. For this you can use method
subString
ofString
class.Recursively do this process until your String becomes empty.
You have to use the Timer for this.It continuously checks the button state pressed or not. Like:
Just cancel the Timer in onDestroy() method, Like: