1

I have three number pickers. One for hours, minutes and seconds. When I'm opening the soft keyboard, the hours opens the qwerty keyboard, while the minutes and seconds pickers opens the numeric keyboard. I'm looking for something like android:inputType="number" That we have in an EditText. This is how I made the numberPickers.

    npHour = (NumberPicker) findViewById(R.id.numberPickerHours);
    npMin = (NumberPicker) findViewById(R.id.numberPickerMinutes);
    npSec = (NumberPicker) findViewById(R.id.numberPickerSeconds);
    String[] hours = new String[100];
    for(int i = 0; i < hours.length; i++)
           hours[i] = Integer.toString(i);

    npHour.setMinValue(0);
    npHour.setMaxValue(99);
    npHour.setWrapSelectorWheel(true);
    npHour.setDisplayedValues(hours);

    String[] minSec = new String[60];
    for(int i = 0; i < minSec.length; i++)
           minSec[i] = Integer.toString(i);

    npMin.setMinValue(0);
    npMin.setMaxValue(59);
    npSec.setMinValue(0);
    npSec.setMaxValue(59);

Also the keyboard has the "done" button rather than the "next" button you will naturally want in the hours and minutes number pickers. How could I do this? Tried descendantFocusability and nextFocus in XML, neither worked.

Kæmpe Klunker
  • 865
  • 1
  • 10
  • 27

0 Answers0