Code example for Spinner

Methods: setSelection

0
        mView.setAdapter(adapter);
        refreshSelectedItem(); 
    } 
 
    void setSelected(int position) {
        mView.setSelection(position);
    } 
 
    int getSelected() { 
        return mView.getSelectedItemPosition();
    } 
 
    int getCount() { 
        return mView.getCount();
    } 
 
    private void refreshSelectedItem() { 
        View selected = mView.getSelectedView();
        if (selected == null) {
            return; 
        }