I’ve got the following issue
I’m implementing an app that provides different types of surveys that has different types of supported questions/answers
- RadioButtons
- Check Boxes
- Text Fields
- Image select
- drag & drop items
what I want is when I change the orientation of the device, I keep the same state
i.e –> the text would still be inside the text field … keep the user’s selections on the Radio Group / Check Boxes… etc
I’ve already tried to override
onsaveInstance & onRestoreInstance
but the problem is I have different types of views & the answer can be viewed as any of them depending on the question type
so I was thinking of saving the whole XML View & then pass it again to the setContentView()
any help?
Use
android:configChanges="keyboardHidden|orientation"in Activity in android manifest file.Example
It is Keep the state of an XML View on orientation change .