I'm looking for a way to implement infinite scrolling in my Firebase
app.
I'm retrieving my data the following way :
I have a list of keys (items a user created, items a user liked and stuff like this) that I am sending to an adapter which gets the data like this :
public void onBindViewHolder(final BaseViewHolder viewHolder, final int position) {
DatabaseReference ref = getAllItemsRef().child(itemIDs.get(position));
ValueEventListener itemListener = new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
Item item = dataSnapshot.getValue(Item.class);
viewHolder.bindItem(item);
}
@Override
public void onCancelled(DatabaseError firebaseError) {
}
};
ref.addValueEventListener(itemListener);
}
I would like to add infinite scrolling to gain performance but I have no idea how I should do that with Firebase
.
I've seen that FirebaseUI
would like to implement it but haven't done it yet.