I have an android app with a MainActivity
which implements a menu with 5 buttons. Each button activates a different fragment
.
Without using the "setOffscreenPageLimit(int limit)"
, every time I go from fragment to fragment, each fragment loads every single time.
Using:
setOffscreenPageLimit(5)
I understand that loads all of my 5 main fragments when starting my application. But I don't want this, because it is too heavy.
I want to implement this: "Load every fragment only when the user activates it, through choosing the menu button.Then keep it on memory , so when user goes back to this fragment, you don't have to load it again."