Get Spinner Adapter - Android User Interface

Android examples for User Interface:Spinner

Description

Get Spinner Adapter

Demo Code


//package com.java2s;
import android.content.Context;
import android.widget.ArrayAdapter;

public class Main {

    public static ArrayAdapter<String> getSpinnerAdapter(Context context,
            String[] datas) {/*from ww  w. j  a va  2s  .  c  o m*/
        ArrayAdapter<String> adapter = new ArrayAdapter<String>(context,
                android.R.layout.simple_spinner_item, datas);
        adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        return adapter;
    }
}

Related Tutorials