I've an arraylist in one fragment that I need to pass to another fragment. Both of these fragments belong to the same container activity. This is what I came up with but apparently there's something wrong with it.
This is how I'm sending the data from Fragment1:
Bundle b=new Bundle();
b.putStringArrayList("Brands",allBrands);
Fragment fragment = new Fragment();
fragment.setArguments(b);
This is how I'm trying to receive the data at Fragment2:
brands = getArguments().getStringArrayList("Brands");
I understand this is not how it is done. Please help me out. I checked the question on implementing fragmentlistener.This isn't about that.