1

I have RecyclerView adapter which loads items when the fragment is initialized. Also I have DialogFragment to add new item. So, How do I know, if the new item is added in the DialogFragment and update the adapter?

I tried to use RecyclerView.AdapterDataObserver, but then I realized that DialogFragment does not know anything about Adapter in the fragment.

earthw0rmjim
  • 19,027
  • 9
  • 49
  • 63
madim
  • 774
  • 10
  • 22
  • define a method inside your recyclerview adapter which will insert new data passed from DialogFragment & after adding the new data to your Collection which might be a list , call notifyDataSetChanged() to reflect the changes in recyclerview. – Gautam Sep 08 '16 at 17:31

0 Answers0