How To Hide/show Progress Bar From Method Onloadingstatechanged In The Firestorepagingadapter?
In my app there is a recyclerview with FirestorePagingAdapter. In the adapter there is method onLoadingStateChanged who is responsible for the loading state. I want to show progres
Solution 1:
To show/hide your homeRecyclerViewProgressBar
, please use the following lines of code in your onLoadingStateChanged()
method:
@Override
protected void onLoadingStateChanged(@NonNull LoadingState state) {
switch (state) {
case LOADING_INITIAL:
homeRecyclerViewProgressBar.setVisibility(View.VISIBLE);
break;
case LOADING_MORE:
case LOADED:
homeRecyclerViewProgressBar.setVisibility(View.GONE);
break;
case FINISHED:
homeRecyclerViewProgressBar.setVisibility(View.GONE);
break;
case ERROR:
retry();
break;
}
}
Post a Comment for "How To Hide/show Progress Bar From Method Onloadingstatechanged In The Firestorepagingadapter?"