2

I want an EditText to always have focus no matter what so I subclassed EditText and added this:

    setFocusable(true);
    setFocusableInTouchMode(true);

        setOnFocusChangeListener(new OnFocusChangeListener() {
        public void onFocusChange(View v, boolean hasFocus) {
            if(!hasFocus) {
                requestFocus();
            }
        }
    });

But the code does not work. Any clue why?

MobileMon
  • 8,341
  • 5
  • 56
  • 75

0 Answers0