I read the documentation, but I don’t quite understand it… What is the parameter "animate" for?
Only thing I noticed:
public void onItemSelected(AdapterView<?> parent, View view, int position, long id)
{
if (savedPosition != -1)
{
((Spinner) parent).setSelection(savedPosition );
savedPosition = -1;
return;
}
//...
}
…works fine with setSelection, but runs into endless loop / StackOverflowError with setSelection(savedPosition, true);
I’m really curious why this would be so?
Well it should be doing what the name suggests. animating from the current position to the desired position. when you use just setSelection the change is more apropriate when you are trying to make sure the user sees the change (sort of a notification of a change) plus it looks smoother. at least that’s why i use it. as for the animating i never had any issues with it.
why are you using the savedPosition instead of position for the selection? maybe that’s what is causing the loop. my suggestion is to try to do it with position and see if it fails. your code is somewhat odd..
ye as the comment suggested you are calling the method again for some reason because i believe the animated setSelection does that when the selection is actually set.