How to undo data received using FirebaseUI-Android?

I am trying to use the FirebaseUI-Android lib to simply display the dataset in recycler mode.

Data is stored in Firebase in a list thanks to the push () method.

When I get data, first I get the oldest data, and my requirement is the youngest in the first place. So I need the reverse order.

  • Is there a way to do this with FirebaseUI itself?

  • With Firebase Core, it seems that there are only two possible ways (from Show messages in descending order ):

    • get all the data and return it at runtime (valid), thanks to @Kato snippet
    • sets the priority each time a button in the list is pressed during recording. This requires that we know every (today and tomorrow) order of use when starting data creation. This is often not the case. Is there another (old or new) option for doing this simple and basic frame work?
+2
source share
1 answer

This must be done at the adapter level, as Firebase pulls out the entire list of objects.

For RecyclerView this is the solution.

mLayoutManager = new LinearLayoutManager(getActivity()); mLayoutManager.setReverseLayout(true); // THIS ALSO SETS setStackFromBottom to true // mLayoutManager.setStackFromEnd(true); mRecyclerView.setLayoutManager(mLayoutManager); 
+3
source

All Articles