android - setOnclickListner is initialized twice? -


passcode1 = (edittext) findviewbyid(r.id.passcode1);      passcode1.setonkeylistener(new onkeylistener() {          @override         public boolean onkey(view v, int keycode, keyevent event) {              if(keycode == keyevent.keycode_del){                    passcode1.requestfocus();                  }             return false;         }     }); 

i have above code in oncreate method have kept break points , try debug see setonkeylistner called or initialized twice.

        passcode1.setonkeylistener(new onkeylistener() {          @override         public boolean onkey(view v, int keycode, keyevent event) {              if(keycode == keyevent.keycode_del && event.getaction() == keyevent.action_up){                    //passcode1.settext(null);                  passcode1.requestfocus();                  return true;                  }             return false;         }     }); 

adding key event solved issue

what understood is initialized twice because has create box key down , key action

thats y added key down check, still initialized twice used once


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -