Issue
I would like to add CardView to an empty RecyclerView list by clicking button. Clicking button again will move the initial CardView down and the next generic CardView will be added to the top of the list.
Solution
Create a method and then call it:
if (mAdapter != null) {
mAdapter.addItem(0, whatever);
mAdapter.notifyItemChanged(0)
mRecyclerView.scrollToPosition(0);
}
Answered By - Seikh Imran
Answer Checked By - Mildred Charles (JavaFixing Admin)