Code example for NumberPicker

Methods: setMaxValuesetMinValuesetOnValueChangedListenersetValue

0
        @Override  
        protected View onCreateDialogView() {
            //Create Views 
            LinearLayout dialogLayout = new LinearLayout(mCtx);
            mTvDialogMessage = new TextView(mCtx);
            mNumberPicker = new NumberPicker(mCtx);
 
            //Set View attributes 
            dialogLayout.setOrientation(LinearLayout.VERTICAL);
            if (mDialogMessage!=null)
                mTvDialogMessage.setText(mDialogMessage);
            dialogLayout.addView(mTvDialogMessage);
            mNumberPicker.setOnValueChangedListener(this);
            dialogLayout.addView(mNumberPicker, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
            if (shouldPersist()) 
                mValue = getPersistedInt(mDefault);
            mNumberPicker.setMaxValue(mMax);
            mNumberPicker.setMinValue(1);
            mNumberPicker.setValue(mValue);
             
//            KeyboardView keyboard =  ((KeyboardView)mNumberPicker.findViewById(android.R.id.keyboardView)); 
//            keyboard.setOnKeyboardActionListener(new KeyboardView.OnKeyboardActionListener() { 
//				 
//				@Override 
Stop searching for code, let great code find you!  Add Codota to your java IDE