mercredi 31 octobre 2018

Long click listener not working for checkbox and radiobutton since setEnabled() is false

I have a checkbox and a radiobutton which has to be in the disabled state, so I give setEnabled(false). But I want longclicklistener to work which is not happening.

This is the piece of code for checkbox, which will be similar to the radiobutton's in my case:

mCheckbox.setEnabled( false );
mCheckbox.setOnLongClickListener( new View.OnLongClickListener() {
            @Override
            public boolean onLongClick( View v ) {
                if( longClickListener != null ) {   //Call didn't even come here while debugging.
                    longClickListener.onLongClick( mCheckbox );
                    return true;
                }
                return false;
            }
        } );

Any help is greatly appreciated.Thanks in advance.




Aucun commentaire:

Enregistrer un commentaire