I have an Activity
which uses several Fragment
s. One of my fragments have an ExpandableListView
which uses an Adapter
of self made. What is the good strategy to keep(or should I keep) and recreate/retain when screen orientation changes:
- reference of the
Fragment
in Activity ExpandableListView
in the fragmentExpandableListView
's states (such as collapsed/opened groups)
What I am currently doing is: reCreating the Fragment
,Adapter
, ExpandableListView
inside Fragment
each and everytime. (Not keeping states yet, but I guess I will use SharedPreferences
).
PS: to minus voters: please elaborate what I am doing wrong. Apparently I am missing some points.