I have a problem with a spinner drop down list and changing orientations.
In my activity, I display a dialog in which I have two spinners. When the dialog is shown t
This occurs because onDetachedFromWindow() does not get called on the spinner when dialog.dismiss() is called. The solution for this is to create a simple custom spinner class the exposes this method.
public class DialogSpinner extends Spinner {
public DialogSpinner(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
public void onDetachedFromWindow() {
super.onDetachedFromWindow();
}
}
Now the onDetachedFromWindow() method is publicly available. Then in your dialog class override the onPause() method.
@Override
public void onPause() {
mYourSpinner.onDetachedFromWindow();
super.onPause();
}
It's definately a workaround, but it seems to do the trick.