इस उम्मीद है कि मदद करते हैं। मैंने कोशिश की है और यह काम करता है
/** Spinner extension that calls onItemSelected even when the selection is the same as its previous value */
public class NDSpinner extends Spinner {
public NDSpinner(Context context)
{ super(context); }
public NDSpinner(Context context, AttributeSet attrs)
{ super(context, attrs); }
public NDSpinner(Context context, AttributeSet attrs, int defStyle)
{ super(context, attrs, defStyle); }
@Override public void
setSelection(int position, boolean animate)
{
boolean sameSelected = position == getSelectedItemPosition();
super.setSelection(position, animate);
if (sameSelected) {
// Spinner does not call the OnItemSelectedListener if the same item is selected, so do it manually now
getOnItemSelectedListener().onItemSelected(this, getSelectedView(), position, getSelectedItemId());
}
}
@Override public void
setSelection(int position)
{
boolean sameSelected = position == getSelectedItemPosition();
super.setSelection(position);
if (sameSelected) {
// Spinner does not call the OnItemSelectedListener if the same item is selected, so do it manually now
getOnItemSelectedListener().onItemSelected(this, getSelectedView(), position, getSelectedItemId());
}
}
}
की
स्रोत
2014-08-25 02:17:24
संभावित डुप्लिकेट [मैं एंड्रॉयड स्पिनर में एक घटना कैसे प्राप्त कर सकते हैं जब वर्तमान चयनित आइटम फिर से चयन किया जाता है?] (Http://stackoverflow.com/questions/5335306/how-can -आई-गेट-ए-इवेंट-इन-एंड्रॉइड-स्पिनर-कब-वर्तमान-चयनित-आइटम-एस-सेल) –