Code example for ArrayAdapter

Methods: getPosition

0
            } 
        }; 
        dropDownEditor.setAdapter(adapter);
        Runnable updateSelection = new Runnable() {
            public void run() { 
                dropDownEditor.setSelection(adapter.getPosition(item.getValueInt()));
            }}; 
        if (item.hasValue())
            updateSelection.run();
        dropDownEditor.setOnItemSelectedListener(new OnItemSelectedListener(){
            public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
                Object oldValue = item.getValue();
                Object newValue = adapter.getItem(position);
                if (newValue.equals(oldValue))
                    return; 
                item.setValue(newValue);
                afterChange.run();
            } 
            public void onNothingSelected(AdapterView<?> parent) {
                // noop 
            }});