Add a new item to recyclerview programmatically?
First add your item to mItems and then use: mAdapter.notifyItemInserted(mItems.size() – 1); this method is better than using: mAdapter.notifyDataSetChanged(); in performance.
First add your item to mItems and then use: mAdapter.notifyItemInserted(mItems.size() – 1); this method is better than using: mAdapter.notifyDataSetChanged(); in performance.
default_data[‘item3’] = 3 Easy as py. Another possible solution: default_data.update({‘item3’: 3}) which is nice if you want to insert multiple items at once.