Search code examples
androidnumberpicker

Android numberpicker set value seen on open


I am looking to set the numberpicker a default value when I click on it. Now it shows "0". I want to pick the number you see as first in the numberpicker. I am working with integers.

It should be very easy, but I can't find it. This needs to be done programmatically.

Many thanks,


Solution

  • You should call setValue() on the NumberPicker instance, if you wish to use a default value:

    numberPicker.setValue(5); // example value