Auto Pagination - Gridview or Listview
Auto Pagination
Load more items when reach bottom
Gridview or Listview
//The following code will allow Recycler view to arrange items in Gridview manner
//The following code is used to Trigger any event when the Recycler view Reach Bottom
Download Code from Google Drive
Codes
Recycler to GRID//The following code will allow Recycler view to arrange items in Gridview manner
recyclerview1.setLayoutManager(new GridLayoutManager(this, 3));
Bottom Reach Listener
//The following code is used to Trigger any event when the Recycler view Reach Bottom
recyclerview1.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
if (! recyclerView.canScrollVertically(1))
{
// add load more Operation here
}
}
});
Firebase Query Listening
Following code to get Items from Firebase with LIMIT
query = dplay.limitToLast((int)limit).orderByChild(key);
query.addValueEventListener(valueEventListener1);
dplay = Database component name
key = The key need to order by
Asd continue 2
}
com.google.firebase.database.Query query;
ASD 3
Download Code from Google Drive
Download this Code from link bellow
Due to some glitch in our blog copy pasting this code will give error when yo copy from here.
So download it from URL Bellow then copy it
https://drive.google.com/file/d/1C4-sgqTbglx7pq-CDpW7NKhKhbcTzQJk/view?usp=drivesdk
str = String variable listmap = Listmap variable
ASD 4
As if any error happens the following part will execute
} catch (Exception e) { showMessage(e.toString()); } }
@Override public void onCancelled(DatabaseError databaseError) { } }; {
Post a Comment