Search code examples
androidsoft-keyboard

Detecting backspace on an empty EditText


I'm trying to detect a soft keyboard backspace in an empty EditText view. I've searched Stack Overflow and also Google and ~20 similar questions, but none have a solution for detecting a backspace in an empty EditText.

All of the answers evolve around this blog article https://code.i-harness.com/en/q/4a914a which specifically notes in the end that this does not detect backspace on an empty EditText view.

Help is much appreciated.


Solution

  • Most reliable solution to detect any event or text change of an EditText is using TextWatcher but if EditText is already empty, you can not detect backspace/delete key event on all devices.

    Please keep it in mind that it is not possible and hopefully you or any other will not waste your time.