I have a "MainActivity"
containing a fragment "fragment1
", this fragment shows a loader until data is fetched using Volley library
. After this fragment1 gets the JSONResponse
, it has to pass the data to the second fragment fragment2
. My data from JSON are as follows:
{ "city": ["Moscow", "Istanbul"],
"Moscow":["Moscow Kremlin", "Red Square", "Gorky Park", "Saint Pittsburgh"],
"Istanbul":["Taksim Square", "Hagia Sophia", "Grand Bazaar", "Spice Bazaar"]}
The problem here is that the number of cities and places are not fixed. Information keeps adding up. I've completed the data retrieval process on fragment1
but I'm unsure how to send it to the second fragment are retrieve the information there. Do I use Bundle
or the onFragmentInteractionListener
? And since there are no associative arrays in Java
, how to I accomplish this?