While I tested my application on an Android Device turning my Android phone from landscape to portrait, results in all the list items in my list view are disappearing.
The simplest way is to use onSaveInstanceState
, explained in Janusz's answer.
However, if there are many items in your list, saving them into a Bundle
in onSaveInstanceState
could slow down the Activity
recreation process, which the users would experience as a lag. To save relatively large data, use onRetainNonConfigurationInstance, then reload data in onCreate
with getLastNonConfugurationInstance
.