I do not know why Google can not do it for so long, but you can solve the problem this way:
You must override the protected method "onDetachedFromWindow" for Spinner, make it as public method, and calling forth it by clicking on the item in your CustomSpinnerAdapter.
For example:
public class CustomSpinner extends Spinner
{
Context context = null;
public CustomSpinner(Context context)
{
super(context);
}
public CustomSpinner(Context context, int mode)
{
super(context, mode);
}
public CustomSpinner(Context context, AttributeSet attrs)
{
super(context, attrs);
}
public CustomSpinner(Context context, AttributeSet attrs, int defStyle)
{
super(context, attrs, defStyle);
}
public CustomSpinner(Context context, AttributeSet attrs, int defStyle, int mode)
{
super(context, attrs, defStyle, mode);
}
@Override public void onDetachedFromWindow()
{
super.onDetachedFromWindow();
}
}
I hope you know how to create SpinnerCustomAdapter and insert this CustomSpinner in xml.