Im using firebase ui recyclerview adapter, as I understand it, when the acivity starts onDataChanged is called and then for every subsequent change in the database it is called again, what I want to do is check every child the first time onDataChanged is called and then only check the child that changed the next time it is called, so I was thinking I could set a boolean to tell the system if its the first time or not, but how can I after that only check the child that changed?
That's what the onChildChanged
method is for. 😁 It'll do exactly what you want:
@Override
public void onChildChanged(@NonNull ChangeEventType type,
@NonNull DataSnapshot snapshot,
int newIndex,
int oldIndex) {
super.onChildChanged(type, snapshot, newIndex, oldIndex);
MyData data = getItem(newIndex);
// Do something
}