create Simple Spinner Array Adapter - Android User Interface

Android examples for User Interface:Spinner

Description

create Simple Spinner Array Adapter

Demo Code


import android.app.Activity;
import android.widget.ArrayAdapter;
import android.widget.Spinner;

public class Main{
    public static <ValueType> ArrayAdapter<ValueType> createSimpleSpinnerArrayAdapter(
            Activity activity, ValueType[] values) {
        ArrayAdapter<ValueType> adapter = new ArrayAdapter<>(activity,
                android.R.layout.simple_spinner_item, values);
        adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

        return adapter;
    }//from  www.  j av a2s  .  com
}

Related Tutorials