How to make NumberPicker non-recurring

If You had set min/max value, try this: yourNumberPicker.setWrapSelectorWheel(false); does this work for you? EDIT For TimePicker: timePicker.setOnTimeChangedListener(new TimePicker.OnTimeChangedListener() { public void onTimeChanged(TimePicker view, int hourOfDay, int minute) { if(hourOfDay>max) { TimePicker.setHour(max): } updateDisplay(hourOfDay, minute); } }); It’s not a tested code, but this could be the way you could do this.

Android NumberPicker with Formatter doesn’t format on first rendering

dgel’s solution doesn’t work for me: when I tap on the picker, formatting disappears again. This bug is caused by input filter set on EditText inside NumberPicker when setDisplayValues isn’t used. So I came up with this workaround: Field f = NumberPicker.class.getDeclaredField(“mInputText”); f.setAccessible(true); EditText inputText = (EditText)f.get(mPicker); inputText.setFilters(new InputFilter[0]);

NPE in ChangeCurrentByOneFromLongPressCommand (on Samsung devices w/ Android 4.3)

So the Samsung NumberPicker is slightly different from AOSP. The code for ChangeCurrentByOneFromLongPressCommand class has some extra logic including if (!mIsDeviceDefault) { // … } else if (mDecrementButton.isShown() || mIncrementButton.isShown()) { // … where mIsDeviceDefault is true when you’re using one of the Theme.DeviceDefault themes (which is the default theme for apps starting Android 4.x) … Read more

Android NumberPicker: Set min, max, default from XML

I had the same problem, this is how I solved it (according to the comment of MKJParekh): I created my own NumberPicker-Class package com.exaple.project; import android.annotation.TargetApi; import android.content.Context; import android.os.Build; import android.util.AttributeSet; import android.widget.NumberPicker; @TargetApi(Build.VERSION_CODES.HONEYCOMB)//For backward-compability public class MyNumberPicker extends NumberPicker { public MyNumberPicker(Context context) { super(context); } public MyNumberPicker(Context context, AttributeSet attrs) { super(context, … Read more

Change the text color of NumberPicker

The solution I tried and worked for me is: In styles.xml add: <style name=”AppTheme.Picker” parent=”Theme.AppCompat.Light.NoActionBar” > <item name=”android:textColorPrimary”>@android:color/black</item> </style> Then use it like this inside your layout: <NumberPicker android:id=”@+id/dialogPicker” android:theme=”@style/AppTheme.Picker” android:layout_width=”match_parent” android:layout_height=”wrap_content” android:layout_marginTop=”15dp” />

How to create a number picker dialog?

I have made a small demo of NumberPicker. This may not be perfect but you can use and modify the same. public class MainActivity extends Activity implements NumberPicker.OnValueChangeListener { private static TextView tv; static Dialog d ; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); tv = (TextView) findViewById(R.id.textView1); Button b = (Button) findViewById(R.id.button11); b.setOnClickListener(new … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)