I try to use the FirebaseUI-Android lib to simply display a data set in a recycler-view.
Data are store in Firebase in a list, thanks to push() method.
When I get the data, I got the oldest data first, and my requirement is the youngest first. So I need a reverse order.
This should be done at adapter level, as Firebase pull the whole list of object.
For a RecyclerView, here is a solution.
mLayoutManager = new LinearLayoutManager(getActivity()); mLayoutManager.setReverseLayout(true); // THIS ALSO SETS setStackFromBottom to true mRecyclerView.setLayoutManager(mLayoutManager); mLayoutManager = new LinearLayoutManager(getActivity()); mLayoutManager.setReverseLayout(true); mLayoutManager.setStackFromEnd(true);