android virtual keyboard listener
Though i have asked the question before but dint开发者_开发问答 get any proper answer. I have an EditText when edit text is focused android virtual keyboard pops up, i have added Done button to the keyboard using ime option from property window. Now i want to perform some action by pressing the Done button. How to do this? Please any body help.
you an do it by firest finding reference of edittext and than set 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 have taken editText name which is ref. editextbox which u added and you have to add actionId==type of ime options which u have setted
精彩评论