0

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.

Mark B
  • 157,487
  • 23
  • 275
  • 266
Brighton Vino
  • 295
  • 3
  • 10

1 Answers1

1

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

Community
  • 1
  • 1
djg
  • 1,273
  • 9
  • 6