Get selected Value from AdapterView - Android User Interface

Android examples for User Interface:AdapterView

Description

Get selected Value from AdapterView

Demo Code


//package com.java2s;
import android.widget.AdapterView;

public class Main {
    public static <T> T selectedValue(T[] values, long index) {
        T result = null;/*from www  .j a  v a 2  s  . co  m*/
        if (index != AdapterView.INVALID_ROW_ID) {
            result = values[(int) index];
        }
        return result;
    }

    public static Integer selectedValue(int[] values, long index) {
        Integer result = null;
        if (index != AdapterView.INVALID_ROW_ID) {
            result = values[(int) index];
        }
        return result;
    }
}

Related Tutorials