Could someone give me an example of how to instantiate a NumberPickerDialog within Activity.onCreateDialog ?(https://github.com/novak/numberpicker/blob/master/lib/src/com/michaelnovakjr/numberpicker/NumberPickerDialog.java) ?
There are examples in a repo called numberpicker-demo for using the widget, but none for the actual dialog.
Amongst other approaches I've tried tried something like:
return new NumberPickerDialog.Builder(this)
.setTitle("Choose Number")
.etc..
But this just shows a standard AlertDialog, without the NumberPicker.
Thanks!
That should be much simpler if only you do this:
Add this code on your Activity
Look at this (and optionaly this: Creating dialogs).
Got it working eventually. There's an example in com.quietlycoding.android.picker.Picker, but I've found that the dialog doesn't set the dimming properly, blacking out the whole Activity in the background while it's in view.
I worked around this by simply creating an AlertDialog in the usual way, and then just sticking a NumberPicker widget into setView():
Make sure to copy number_picker_pref.xml from the numberpicker project to res/layout in your own project.