Reputation: 395
I have a Spinner in my Activity with a list of Options. By default my first Item on the list is in Selected State when I start the Activity.
Assume My List has <Circle> <Square> <Rectangle> <Triangle>
When Activity is created for the first time Circle is Selected. Suppose I select Rectangle. Then I navigate to another Activity and then recreate the Activity. My selection is restored to the first Item again. How can I save my previous selected option.
Upvotes: 0
Views: 860
Reputation: 1283
What are the Object types in your list? Strings?
Try overriding onSaveInstanceState
and onRestoreInstanceState
This answer has a nice example: Saving Android Activity state using Save Instance State
Upvotes: 1