0

As the title, is there any way to remove all listeners without it's name or some thing like that?

This is what I am doing:

ref.removeEventListener(valueEventName);
Alex Mamo
  • 130,605
  • 17
  • 163
  • 193
  • why did my question is marked duplicate ? please read the question carefully, I dont ask about how to remove. I want to know if there is a way to remove Listener without its name. – Trần Quốc Trung Mar 25 '19 at 13:45
  • Hey Tran. To remove an event listener from a query, you must have a reference to the listener. See https://firebase.google.com/docs/reference/android/com/google/firebase/database/Query.html#removeEventListener(com.google.firebase.database.ChildEventListener) – Frank van Puffelen Mar 25 '19 at 14:35
  • thanks @FrankvanPuffelen , I already knew that. I just confuse a little bit about remove Listener without its name. But I think it is not posible. – Trần Quốc Trung Mar 25 '19 at 15:31

1 Answers1

0

To be able to remove a listener from a query/location in Android, you need to have a reference to that listener. See the reference docs.

There is no method in the Android SDK to remove all listeners from a query/location.

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807