android - Best way to use fragments on orientation changed -
i have been searching fragments days. not find example or question case. in case, orientation change , saving state important.
in app, there many steps. each step, there fragment on portrait mode. user sliding on them next step. on landscape mode, steps on 1 screen.no sliding. when orientation changes, states should saved. during using application user change orientation anytime he/she wants.
can give me example this?
my current approach that: portrait: many fragments landscape: 1 fragment , not 1 of portrait fragments.
you can create folder in res folder , have layout portrait mode , landscape mode.
as saving data, see onsavedinstancestate , onrestoreinstancestate these methods called when screen flipped, if have data must save in onsavedinstancestate , recover in onrestoreinstancestate.
Comments
Post a Comment