开发者

Android spinner value gets lost when i open new activity?

开发者 https://www.devze.com 2023-03-04 21:45 出处:网络
Android spinner value gets lost when i open new activity and come back from that activity to my previ开发者_开发知识库ous one.how do i retain my spinner index?use activity life cycle methods to save t

Android spinner value gets lost when i open new activity and come back from that activity to my previ开发者_开发知识库ous one.how do i retain my spinner index?


use activity life cycle methods to save the state of the Activity and restore the Activity state to the previous state. those methods are onPause(), onResume() http://developer.android.com/reference/android/app/Activity.html follow this link


You can override the onSaveInstanceState and onRestoreInstanceState methods in the Activity class and save/restore the value of your index.

http://developer.android.com/reference/android/app/Activity.html#onSaveInstanceState(android.os.Bundle)

0

精彩评论

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