Android, on finish loading data from firebase

前端 未结 2 1930
予麋鹿
予麋鹿 2021-01-17 06:27

How to show the Progressbar on start of the activity that contains recycler view which should be hidden once the recycler view loads the data from firebase database?

2条回答
  •  春和景丽
    2021-01-17 07:01

    Assuming you are using a FirestoreRecyclerAdapter, to solve this, create a new object of ProgressBar and start showing it in the onCreate() method, or if you want add it directly in your .XML file and finally in your adapter class, override the following method:

    @Override
    public void onDataChanged() {
        if (progressBar != null) {
            progressBar.setVisibility(View.GONE);
        }
    }
    

提交回复
热议问题