• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps EditText not able to regain focus.

Andrew121

Lurker
Code:
 if (isChecked) {
                editText.setFocusable(false);
                editText.setEnabled(false);
            } else {
                editText.setEnabled(true);
                editText.setFocusable(true);
 }

So this is called after a checkbox is clicked on. When it's checked the textbox goes gray and it cannot gain focus. When it's unchecked the textbox goes white again, but it still cannot gain focus. So the problem here is that an edit text view cannot regain focus after being re-focusable. isFocusable returns true. Is this a bug???? I've been looking for an answer for quite a while.
 
I thought the focus was also bugged but I figured out the solution in my case:

Try also flipping the setFocusableInTouchMode switch as well.

That is, add
Code:
editText.setFocusableInTouchMode(true/false);
as appropriate
 
Back
Top Bottom