I\'m using firestore paging adapter to populate my RecyclerView with data from Firestore, if collection in Firestore is empty I would like to show a TextV
I solved this problem by simple code. Just override onLoadingStateChangedListner method inside your FirestorePagingAdapter and then use getItemCount.
I implemented it as follow -
@Override
protected void onLoadingStateChanged(@NonNull LoadingState state) {
switch (state){
case LOADED:
case FINISHED:
progressBar.setVisibility(View.GONE);
if(getItemCount() == 0) {
emptyIcon.setVisibility(View.VISIBLE);
recyclerview.setVisibility(View.GONE);
}
break;
}
super.onLoadingStateChanged(state);
}