I have activity A and activity B in Android.
In activity A there are a FirestoreRecyclerAdapter
and a FirestoreRecyclerOptions
object, whic
When you are using Query's addValueEventListener() method, you should remove the listener according to the life-cycle of your activity, as explained in my answer from the following post:
If you are using the Firebase-UI library, once you start listening for changes in your onStart()
method:
@Override
protected void onStart() {
super.onStart();
firestoreRecyclerAdapter.startListening();
}
You also need to stop listening for changes in onStop()
method:
@Override
protected void onStop() {
super.onStop();
if(firestoreRecyclerAdapter != null) {
firestoreRecyclerAdapter.stopListening();
}
}