Tuesday, December 14, 2010

Spinner.setSelection doesn't work correctly

Problem:
There are a lot of posts around regarding a problem with Spinner.setSelection(i) function. I encountered this issue when I've tried to replace the adapter in the Spinner and select a new item. The setSelection function seems like it's not working, but when I click the spinner the selected item was the correct one.

Solution:
Use Spinner.setSelection(i, true) instead

2 comments:

Yar said...

Man, thank you very much for this answer.

Unknown said...

Hi
I have this problem, but your solution does not work for me!

I have two spinner, first change correctly, but second does not change at all.

I will appreciate if you help me.

Thanks Fazileh.