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();
Fragment fragment = new Fragment();
brands = getArguments().getStringArrayList("Brands");
There are few different ways of communicating between fragments.
1) creating a interface 2) shared preferences 3) sqlite database
using 1) you create a common method where the information can be read by both fragments.
using 2) is great to save the information forever until overwritten or deleting the app.
using 3) same as the second one but it depends on the app if you really need a database or not.