This solution works for me perfectly.ĬustomEditText.java public class CustomEditText extends EditText else if (event.action = KeyEvent.ACTION_UP & !event.isCanceled & state. After this, one back press enough for solve your problem. And then you have to implement onKeyPreIme method which controls KeyEvent.KEYCODE_BACK. So the question: is it possible to intercept back button to close soft keyboard and finish activity in one press of back button without creating custom InputMethodService P.S. When back button pressed soft keyboard closes and to close activity I need to press back button one more time. Initially, you have to create custom edit text that extends EditText. When activity started soft keyboard is shown. ![]() OnKeyDown() and onBackPressed() doesn't work for this case.
0 Comments
Leave a Reply. |