Because Key has a down and up event, it executes two times.
class Edittextonkeyclicklistener implements Etonkeyclicklistener {@Override Public BooleanOnkeyclick (View V,intKeyCode, KeyEvent event) {//TODO auto-generated method stub if(KeyCode = = keyevent.keycode_enter&& event.getaction () = = Keyevent.action_down) {Inputmethodmanager IMM = (Inputmethodmanager) v.getcontext (). Getsystemservice (Con Text. Input_method_service); Key = Search_edit_text.gettext (). toString ();if(Imm.isactive ()) {Imm.hidesoftinputfromwindow (V.getapplicationwindowtoken (),0); } load_view.setvisibility (view.visible); page =0; Searchbookasynctask task =NewSearchbookasynctask (Key, Load_view, view, Mybooklist, Search_book_adapter, page,NULL,NULL,0, list, SHOWLIST,BG); Task.execute (); }return false; } }
Android EditText hit Enter will respond two times to the solution