I am having a requirement where there are several buttons in a activity, and clicking on one will change the background. The activity refreshes on orientation change. Then i included, android:configChanges="keyboardHidden|screenSize"
which solves the problem, but i have separate screens for portrait and landscape modes, this saves the state and do not pick the layout for landscape when the orientation is changes. Please guide how i can change the orientation but still prevent the activity refresh and thus saving the clicked button and background color.
Asked
Active
Viewed 4,288 times
1

bharath
- 953
- 4
- 17
- 30
2 Answers
4
dont use android:configChanges="keyboardHidden|screenSize"
and use onSaveInstanceState() for return color or resource id of background and then check it in oncreate() for set background
this example help you How to use onSavedInstanceState example please

Community
- 1
- 1
-
Thanks for the reply, can u plz guide with an example snippet? – bharath Jun 18 '13 at 04:13