For the screen rotation, I’ve implemented attribute android:ConfigChanges=”orientation|screenSize” in manifest file. Everything works fine. But this link here suggests to consider this approach to be last resort and not recommended one.
What would be the better way of handling this screen rotation ?
(FYI: My app implements multiple spinners to get info from user and then writes to a file. so by default, when a screen rotation happens, i would loose all info that user selected)
help please.
For the screen rotation, I’ve implemented attribute android:ConfigChanges=orientation|screenSize in manifest file. Everything works fine.
Share
Delete that attribute.
If you find that you need to pass information from the old activity instance to the new one, on the configuration change, you can put data in the
Bundleyou are passed inonSaveInstanceState(), and use that data inonRestoreInstanceState()to tailor your UI. In the case of aSpinner, you can pass the selected position this way, restoring it in the new activity.