Android Question Still LostFocus

A button wouldn't normally take the focus, so if you make it focusable, the first click is consumed by the focus.

Can you explain your intended usage, there may be an other way to achieve what you're after.
 
Upvote 0
The feature that I would get is simple, in theory :mad:.

Let's say I have a EditText; the user enters text and then press the OK button.

It is obvious that I could check the contents entered in the EditText inside the btnOK_Click event, but it is just an example to say that when the user presses OK, the event EditText_FocusChanged does not fire.
 
Upvote 0
As thedesolatesoul said, pressing the OK button in an edittext doesn't necessarily move the focus, unless there is another focusable view for it to go to and you haven't set force done on the keyboard.
 
Upvote 0
If you want the buttons to be focusable you can set it using JavaObject:

Code:
DIm JO AS JavaObject = Button1
JO.RunMethod("setFocusable",Array As Object(True))

Or

Code:
DIm JO AS JavaObject = Button1
JO.RunMethod("setFocusableInTouchMode",Array As Object(True))

In this case, you might as well write:
EditText1_FocusChanged (True)

You'd probably be better off using the TextChanged event
 
Upvote 0
1) the button is in the focused state, it can have a different graphic (Which may be the same as pressed by default because buttons are not normally focusable) but you can change it using a statelistdrawable if you really want to.

2) see #4
 
Upvote 0
Back
Top