0
Firebase Listener - Android Studio- Java
Firebase listeners get triggered on 2 conditions: 1. When initialized 3. When a document is being updated I want my listener to be triggered only on the 2nd condition, how can I do it?
2 Antworten
+ 1
Try using a boolean. You could create a boolean "initialized" that is false at first. Then in the onDataChanged() method you can check if initialized is false or not. If it is false then simply return. Next after you attach the listener to a DatabaseReference or any other thing then simply set the initialized variable to true. Hope this works.
+ 1
Rivan it does, thats basically what I did :)