hi i have edittext with imeoption actionsearch ,when i click search icon in virtual keyboard i need to invoke a function, i have ove开发者_开发技巧rride onKeydown but i won't get controll when i press search , what i do
ed1.setOnEditorActionListener(new OnEditorActionListener() {        
        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
        if(actionId==EditorInfo.IME_ACTION_SEARCH){
            System.out.println("Search pressed.........");
        }
            return false;
        }
    });
search_edit.setOnKeyListener(new OnKeyListener() {
                @Override
                public boolean onKey(View v, int keyCode, KeyEvent event) {
                    System.out.println("The key pressed onkeylistenere is having code: "+keyCode);
                    System.out.println("The key pressed onkeylistenere is having event: "+event);
                    return false;
                }
            });
try this & press "search" get the keycode & use
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论