Android Virtual Keyboard Listener

Although I asked a question earlier, but give the correct answer. I have an EditText, when the text being edited is focused on the Android virtual keyboard, I added the Done button to the keyboard using the ime option from the properties window. Now I want to perform some actions by clicking the "Finish" button. How to do it? Please help any body.

+4
source share
1 answer

you do this by finding the edittext link and setting the belows code for ur edittext:


editText.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_SEARCH) { performSearch();//do here your stuff f return true; } return false; } }); 

here I took the name editText, which is ref. editextbox which u added and you have to add actionId == type of ime parameters you set

+7
source

Source: https://habr.com/ru/post/1336555/


All Articles