How to save Spinner state in onSaveInstanceState when changing orientation in android

I want to keep the state (i.e. contents) of the counter bound to the adapter when the orientation changes. I use the onSaveInstanceState (Bundle savedInstanceState) and onRestoreInstanceState (Bundle savedInstanceState) methods. Will you have a phased process for saving content?

Thanx

+4
source share
1 answer

Here is a great example of how to do this (look at onPause and onResume), Spinner Example . I would also strongly suggest adding activity testing (e.g. unit testing) to make sure that you recover all your states during life cycles. unit test example .

+1
source

Source: https://habr.com/ru/post/1338693/


All Articles