Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android

aakarshrestha
aakarshrestha
6,509 Points

Data from web service call in listview disappears when i replace the fragment and later return to the same fragment.

I have bottom navigation bar in the MainActivity, it is used to access four fragments namely "A-frag", "B-frag", "C-frag" and "D-frag". To navigate from one fragment to another fragment, i am replacing the fragment. For example, Moving from A-frag to B-frag, i use replace method of fragment.

A-frag has a listview that gets the webservice data. After navigating from A-frag to B-frag and then to A-frag again, my listview is empty.

Any help is highly appreciated!

1 Answer