I donโt know why Google cannot work for so long, but you can solve this problem as follows:
You must override the protected method "onDetachedFromWindow" for Spinner, make it public and call it by clicking on the item in the 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(); } }
Hope you know how to create a SpinnerCustomAdapter and insert this CustomSpinner in xml.
cosic
source share