开发者

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

开发者 https://www.devze.com 2023-02-09 03:59 出处:网络
I want to save the state (ie. content) of spinner tied to an Adapter when chnaging the orientatio开发者_运维百科n. I am using onSaveInstanceState(Bundle savedInstanceState) and onRestoreInstanceState(

I want to save the state (ie. content) of spinner tied to an Adapter when chnaging the orientatio开发者_运维百科n. I am using onSaveInstanceState(Bundle savedInstanceState) and onRestoreInstanceState(Bundle savedInstanceState) method . Will u give the step by step process how to save the content?

Thanx


Here is an excellent example of how to do this (look at onPause & onResume), Spinner Example. I would strongly suggest also adding activity testing (aka unit testing) to make sure you restore all your states around the lifecycles. unit test example.

0

精彩评论

暂无评论...
验证码 换一张
取 消