Skip to content Skip to sidebar Skip to footer

Onfocus Not Work For Button

final View b= (Button) findViewById(R.id.find); b.setOnFocusChangeListener(new View.OnFocusChangeListener() { @Override public void onFocusChange(View v,

Solution 1:

I have checked it. It works. Note that on Emulator the onFocus happens when you go to the button via scrolling the up/down arrow.

I have the following code:

btnSign.setOnFocusChangeListener(newOnFocusChangeListener() {
        @OverridepublicvoidonFocusChange(View v, boolean hasFocus) {
            // TODO Auto-generated method stubif (hasFocus) {
                //Toast line...
            }
        }

    });

For button why have u used :

final View ??? May be thats the problem..

use Button b= (Button) findViewById(R.id.find);

Post a Comment for "Onfocus Not Work For Button"