T
T
Tsuzukeru2020-08-26 14:24:36
Android
Tsuzukeru, 2020-08-26 14:24:36

How to catch back key press in EditText?

I work with EditText. I understand how to catch the event when the Send button is clicked, but how to catch the Back key?
I tried different options, but it turned out to be solved only by redoing the EditText in Custom View.
https://rmcreative.ru/blog/post/android-poymat-bac...
Are there easier ways to solve this problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
alekseyHunter, 2020-08-28
@alekseyHunter

Option 1: Add an onKeyListener handler for the EditText.
Option 2: Add an onBackPressed handler to the Fragment/Activity.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question