android - My app resets my integers when switching from horizontal to vertical -
this question has answer here:
- activity restart on rotation android 28 answers
so first app on android , it's working great. however, when tilt screen horizontal view integers reset zero. if start horizontally switch vertical, resets integers 0 too. how can not reset , switch?
override onsaveinstancestate(bundle outstate)
method. put data in outstate
bundle, , then, in oncreate(bundle savedinstancestate)
, extract savedinstancestate
.
if data more complex trivial integer, , not implement parcelable
interface, use fragment
.
Comments
Post a Comment