Code example for Spinner

Methods: setSelectionsetAdapter

0
            mSelected = obj.optInt("selected");
        } 
 
        public View getView(final Context context) throws UnsupportedOperationException {
            if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
                spinner = new Spinner(context);
            } else { 
                spinner = new Spinner(context, Spinner.MODE_DIALOG);
            } 
            try { 
                if (mListitems.length > 0) {
                    ArrayAdapter<String> adapter = new ArrayAdapter<String>(context, android.R.layout.simple_spinner_item, mListitems);
                    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
 
                    spinner.setAdapter(adapter);
                    spinner.setSelection(mSelected);
                } 
            } catch(Exception ex) { }
 
            if (!TextUtils.isEmpty(mLabel)) {
                LinearLayout container = new LinearLayout(context);
Connect your IDE to all the code out there  Get Codota for Java