Skip to content
Advertisement

Populating NumberPicker in custom made Dialog

I’m trying to populate a NumberPicker on a custom made dialog. At the moment I’m using a method which uses a View and inflates another layout (the dialog), the method should then populate the NumberPicker but when I call it in onCreate it doesn’t.

The code for the method:

JavaScript

EDIT:

The idea of this is to pick the duration of something (not the time) – sorry if this caused confusion!

Advertisement

Answer

Since you just want consecutive numbers there’s no need to create the side arrays.

You can do it as follows:

JavaScript

If this is not working please post your XML layout and the full activity code (at least the onCreate() method).

Reference:

NumberPicker Class

Update

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement