Add item recyclerView

Add item recyclerView

When We add a item in our recyclerView, first step is in our adapter We must to add this:

void addItem(VerticalData dataObj, int index) {
        mDataset.add(dataObj);
        notifyItemInserted(index);
    }

And now our fragment or activity we call the method like this:

mAdapter.addItem(object, mAdapter.getItemCount());

Example in GitHub

Leave a Reply

Your email address will not be published. Required fields are marked *