0

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;
    }
});
Lukap
  • 31,523
  • 64
  • 157
  • 244

1 Answers1

2

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.

Knossos
  • 15,802
  • 10
  • 54
  • 91