fill Spinner - Android User Interface

Android examples for User Interface:Spinner

Description

fill Spinner

Demo Code


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

public class Main {
    public static void fillSpinner(Context ctx, Spinner spinner,
            String[] data) {/*from  w  w  w.  j  a  va2  s  .  co  m*/
        ArrayAdapter<String> adapter = new ArrayAdapter<String>(ctx,
                android.R.layout.simple_spinner_item, data);
        adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        spinner.setAdapter(adapter);
    }
}

Related Tutorials