Example usage for android.widget SpinnerAdapter getViewTypeCount

List of usage examples for android.widget SpinnerAdapter getViewTypeCount

Introduction

In this page you can find the example usage for android.widget SpinnerAdapter getViewTypeCount.

Prototype

int getViewTypeCount();

Source Link

Document

Returns the number of types of Views that will be created by #getView .

Usage

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);
    }
}