What does it means when the listener is null

840 views Asked by At

I have read some code that people use something like this

view.setOnLongClickListener(null);

What does it means and for what can be useful ? why someone uses this ?

is that the same as this

view.setOnLongClickListener(new OnLongClickListener() {

    public boolean onLongClick(View v) {
        return true;
    }
});
1

There are 1 answers

0
Knossos On BEST ANSWER

Null would remove any callbacks that are currently set as the views listener.

It definitely isn't the same as the second one, which assigns a listener to the view to control what will happen when you perform a long click on your view.