mercredi 5 octobre 2016

Android retaining information across fragments

Vote count: 0

I have five fragments a user can switch between. One of these fragments loads a list of users from the server to populate the UI list on the fragment. I need the list information to persist if a user swipes to a different fragment and then swipes back to the original. I do not want the fragment to reload the users every time a user leaves the fragment and goes back.

I am looking at setRetainInsance(true) and was wondering if this is possible solution? What would be the best way for the fragment to retain the information without being created from scratch each time.

I am using this to switch between fragements -getSupportFragmentManager().beginTransaction().replace(R.id.searchLayout, ratingFragment).commit();

asked 22 secs ago

Let's block ads! (Why?)



Android retaining information across fragments

Aucun commentaire:

Enregistrer un commentaire