Focus problem with multiple EditText's?

I faced the same problem, one of my EditText has an OnFocusListener and when it lose focus I do some transformations, but if something goes wrong I try to requestFocus again and let the user to fix the problem. Here's when the problem shows up, I end up with to EditText with focus, I tried to search the view with the focus but the findFocus() returned null. The only solution I found was to create a EditText variable private EditText requestFocus; If any problem, I set my EditText to that variable and here is what I don't like but it works, I set OnFocusListener to the other views on my activity.

When they gain focus, I do this @Override public void onFocusChange(View v, boolean hasFocus) { if (hasFocus) if(requestFocus! = null){ v.clearFocus(); requestFocus.requestFocus(); requestFocus = null; } } I clear the focus from the view that has it, I request Focus and set the variable requestFocus null. I believe that this is happening because at the time I request a Focus no one has a focus yet, my EditText regain the focus and the the activity gives focus to the next view.

Hope it helps to someone.

I faced the same problem, one of my EditText has an OnFocusListener and when it lose focus I do some transformations, but if something goes wrong I try to requestFocus again and let the user to fix the problem. Here's when the problem shows up, I end up with to EditText with focus, I tried to search the view with the focus but the findFocus() returned null. If any problem, I set my EditText to that variable and here is what I don't like but it works, I set OnFocusListener to the other views on my activity.

I clear the focus from the view that has it, I request Focus and set the variable requestFocus null. I believe that this is happening because at the time I request a Focus no one has a focus yet, my EditText regain the focus and the the activity gives focus to the next view. Hope it helps to someone.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions