0

I have implemented a NumberPicker in which we can roll the numbers from 0 to 99. But my requirement is I only want 1,2,3,4,5,99, these number to be rolled in NumberPicker. Is it possible to do this?

I have tried this where mPicker is the object of NumberPicker

String[] nums= {"1","2","3","4","5","99"};
mPicker.setDisplayedValues(nums);

But in this Am not able to roll it, only be able to type through SoftInputKeyboard. Can anybody help to takle this and get it done without any third party libraries.

Charles
  • 50,943
  • 13
  • 104
  • 142
Sreedev
  • 6,563
  • 5
  • 43
  • 66
  • 1
    Please have a look at here.... [Android NumberPicker: Set min, max, default from XML](http://stackoverflow.com/questions/12317960/android-numberpicker-set-min-max-default-from-xml) –  Apr 23 '14 at 06:19
  • @user3110424 Thanks for the fast response, I solved the issue. :-) – Sreedev Apr 23 '14 at 06:24
  • Good happy coding :-) –  Apr 23 '14 at 06:25
  • 1
    Please note that tags are not keywords. Stuffing the tag list full of the same words that are in your question (number, picker) will not help categorize it. Always be sure to read the descriptions that appear when selecting tags! – Charles Apr 23 '14 at 17:20

1 Answers1

1

I solved this problem by doing like this

mPicker.setMaxValue(5);
mPicker.setMinValue(0);

String[] nums= {"1","2","3","4","5","99"};
mPicker.setDisplayedValues(nums);

Setting max value to 5 and adding 5 values to to show.

Sreedev
  • 6,563
  • 5
  • 43
  • 66