Search code examples
android-fragmentsarraylistfragmenttabactivityandroid-tabactivity

Pass ArrayList<String> from fragment to another fragment


I have a problem. I'm building an Android app. I created a Tabbed Activity with Android Studio. I have 3 tabs. I created 3 classes java with their relative xml. In first tab I take data from internet with Jsoup and i put these data in 2 ArrayList. I want to pass these ArrayList to tab2 and tab3 to avoid downloading again these data.

How can i do? I tried with bundle and getter/setter but I have not been successful


Solution

  • The solution is to be make that ArrayList as static one. Once you got the required data in fragment A then assign that data into ArrayList. Now you can easily access from anywhere.