Add item recyclerView
When We add a item in our recyclerView, first step is in our adapter We must to add this:
1 2 3 4 | void addItem(VerticalData dataObj, int index) { mDataset.add(dataObj); notifyItemInserted(index); } |
And now our fragment or activity we call the method like this:
1 | mAdapter.addItem(object, mAdapter.getItemCount()); |