Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.widget.Spinner;

public class Main {
    public static void setSpinnerSelection(Spinner spinner, int position) {
        if (spinner.getSelectedItemPosition() != position) {
            spinner.setSelection(position);
        } else {
            spinner.getOnItemSelectedListener().onItemSelected(spinner, spinner.getSelectedView(), position,
                    spinner.getAdapter().getItemId(position));
        }
    }
}