• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps problem on "Spinner"

xiaojxiao

Newbie
Hi~

I have used spinner in my app. When I use "setSelection(pos)" first time, it works correctly. But if I make another calling for "setSelection(pos)" after, the spinner will always show the first position instead of showing the correct position which is not 0.
I have checked the code, and the position value is correct.
How to solve this problem?:confused:

I have google it, and the link below shows the same unsolved problem as mine.
[android-developers] Spinner setSelection(int) problem - bryan - com.googlegroups.android-developers - MarkMail

Thanks very much.
 
You could force the widget/view to redraw by invalidating it. However if this is a bug deeper within the widget draw logic, invalidating may not produce the proper result.

But its possible that the setSelection() call didn't invalidate the view, so the framework doesn't know it needs to redraw the widget with the new value.

Just a guess...
 
You could force the widget/view to redraw by invalidating it. However if this is a bug deeper within the widget draw logic, invalidating may not produce the proper result.

But its possible that the setSelection() call didn't invalidate the view, so the framework doesn't know it needs to redraw the widget with the new value.

Just a guess...

Thanks~~;)
 
Just dropped by to say thanks.
I was struggling with this one for quite a while before I bumped into your answer.

Thank you!
 
Back
Top Bottom