List of usage examples for android.widget SpinnerAdapter getViewTypeCount
int getViewTypeCount();
Returns the number of types of Views that will be created by #getView .
From source file:android.support.v7.internal.widget.SpinnerCompat.java
@Override public void setAdapter(SpinnerAdapter adapter) { super.setAdapter(adapter); mRecycler.clear();/*from w w w. ja v a 2 s . c om*/ final int targetSdkVersion = getContext().getApplicationInfo().targetSdkVersion; if (targetSdkVersion >= Build.VERSION_CODES.LOLLIPOP && adapter != null && adapter.getViewTypeCount() != 1) { throw new IllegalArgumentException("Spinner adapter view type count must be 1"); } if (mPopup != null) { mPopup.setAdapter(new DropDownAdapter(adapter)); } else { mTempAdapter = new DropDownAdapter(adapter); } }