Code example for NumberPicker

Methods: clearFocushasFocussetEnabledsetMaxValuesetMinValue, setFocusable, setFocusableInTouchMode, setOnFocusChangeListener

0
                nameEdit.clearFocus();
            } else if (univEdit.hasFocus()) {
                univEdit.clearFocus();
            } else if (startAddrEdit.hasFocus()) {
                startAddrEdit.clearFocus();
            } else if (endAddrEdit.hasFocus()) {
                endAddrEdit.clearFocus();
            } 
        } 
 
        nameEdit.setFocusable(enabled);
        nameEdit.setFocusableInTouchMode(enabled);
        univEdit.setEnabled(enabled);
        univEdit.setFocusable(enabled);
        univEdit.setFocusableInTouchMode(enabled);
        startAddrEdit.setEnabled(enabled);
        startAddrEdit.setFocusable(enabled);
        startAddrEdit.setFocusableInTouchMode(enabled);
        endAddrEdit.setEnabled(enabled);
        endAddrEdit.setFocusable(enabled);
        endAddrEdit.setFocusableInTouchMode(enabled);
        valueSeekBar.setEnabled(enabled);
        valueSeekBar.setFocusable(enabled);
        valueSeekBar.setFocusableInTouchMode(enabled);
    } 
 
    @Override 
    public void onItemAdded(Light light) {
        super.onItemAdded(light);
        nameEdit.setText(light.getName());
        setControlsEnabled(true); 
        updateItemView(false); 
    } 
 
    @Override 
    public void onFocusChange(View view, boolean hasFocus) {
        showHideKeyboard(view, hasFocus);
    } 
 
    @Override 
    public void onViewCreated(View view, Bundle savedInstanceState) {
        nameEdit = (EditText)getView().findViewById(R.id.light_detail_name_edit);
        nameEdit.setOnFocusChangeListener(this);
 
        univEdit = (NumberPicker)getView().findViewById(R.id.light_detail_universe_picker);
        startAddrEdit = (NumberPicker)getView().findViewById(R.id.light_detail_addr_picker);
        endAddrEdit = (NumberPicker)getView().findViewById(R.id.light_detail_end_addr_picker);
        valueLabel = (TextView)getView().findViewById(R.id.light_detail_light_value_label);
        valueSeekBar = (SeekBar)getView().findViewById(R.id.light_detail_light_value);
 
        univEdit.setOnFocusChangeListener(this);
        univEdit.setMinValue(0);
        univEdit.setMaxValue(2);
 
        startAddrEdit.setOnFocusChangeListener(this);
        startAddrEdit.setMinValue(1);
        startAddrEdit.setMaxValue(512);
 
        endAddrEdit.setOnFocusChangeListener(this);
        endAddrEdit.setMinValue(1);
        endAddrEdit.setMaxValue(512);
 
        valueSeekBar.setMax(255);
        valueSeekBar.setOnSeekBarChangeListener(this);
 
        setControlsEnabled(false);