try { Method method = Spinner.class.getDeclaredMethod("onDetachedFromWindow"); method.setAccessible(true); method.invoke(spinner); } catch (Exception e) { e.printStackTrace(); } ```