How to add 2 different queries inside an FirestoreRecyclerAdapter?

后端 未结 2 425
终归单人心
终归单人心 2020-12-06 23:22

I have two queries:

Query firstQuery = ref.orderBy(\"name\", Query.Direction.ASCENDING).limit(10);
getData(firstQuery);

Query secondQuery = ref.orderBy(\"pr         


        
2条回答
  •  难免孤独
    2020-12-06 23:44

    There is nothing built-in to combine two queries in a FirestoreRecyclerAdapter.

    The best I can think of is creating a List/array of the combined results in your app code and then using an array adapter. It's not ideal, since you won't be using FirebaseUI.

    Alternatively, have a look at FirebaseUIs FirestorePagingAdapter, which combines multiples pages of (non-realtime) DocumentSnapshots in a single recycler view.

提交回复
热议问题