I have developed an Android app by following INSTAGRAM App with Firebase - Android Studio Tutorial on YouTube.
The code works fine, but the issue is all the posts are loading same time making app slow. I want to show only 10 initial posts then want to load the next 10 and so on.
Could you help me achieve this?
private void readPosts() {
DatabaseReference reference = FirebaseDatabase.getInstance().getReference("Posts");
reference.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
postLists.clear();
for (DataSnapshot snapshot : dataSnapshot.getChildren()){
Post post = snapshot.getValue(Post.class);
for (String id : followingList){
if (post.getPublisher().equals(id)){
postLists.add(post);
}
}
}
postAdapter.notifyDataSetChanged();
progressBar.setVisibility(View.GONE);
}
}
}
The above code works fine and posts are laoded but slow.
--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/cae46899-5c32-4d09-a53e-3476cc9d4373o%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/CAE6e%2BPjH8udNXTyUWfzuvzkhSkmNVmk9QcyjuSx8KZ7o78tCQA%40mail.gmail.com.