UPDATE
I\'ve solved the clicking issue by removing the two focusable lines from the button style and using the onClick event handler to call r
you can do like this in onClick(View v)
:
.....
v.setFocusableInTouchMode(true);
v.requestFocus();
v.setFocusableInTouchMode(false);
.....//the others
so, v
gets focus and you can do something in onClick()
through setFocusableInTouchMode(false)
, it can accept onClick
at first touch.
You might need to use an OnFocusChangeListener and then check if the focus event happened when the screen was in touch mode: if it did then it was a user click, otherwise it was from the trackball/trackpad.
You can use onTouch
. This way you can handle all clicks without having to set OnFocusChangeListener
.