Firebase android how to prevent FirebaseRecyclerAdapter automatically updating?

旧街凉风 提交于 2020-02-20 08:53:42

问题


I have a FirebaseRecyclerAdapter which I do not want to keep updating the RecyclerView. This is because I have it so it populates the view with items based on how many 'views' they have in the database. The problem is, if other people view the items, the list you see in the app will keep changing order. Is there a way to stop the recycler adapter from constantly listening for data changes or will I have to go about this another way?

Any help is greatly appreciated, thanks.


回答1:


The adapters in FirebaseUI are live-bound to the data at the Query/DatabaseReference that you construct them with. There is no way to turn this behavior off in the adapter.

But you can easily create a ValueEventListener that populates a static List<T> and feeds that into an ArrayAdapter.



来源:https://stackoverflow.com/questions/37465409/firebase-android-how-to-prevent-firebaserecycleradapter-automatically-updating

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!