michaelmuenzer / ScrollableNumberPicker

Easy to use customizable number picker for Android mobile and tv
MIT License
78 stars 22 forks source link

Question: Access through code #11

Open CJBH opened 6 years ago

CJBH commented 6 years ago

Hi there! Awesome idea this. I have a problem though. I am trying to set min, max and value through code but i keep getting Null Pointer Exception. When i set it in XML it works fine. This is what i try:

npYob.setValue(1971);

This is what i get: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.michaelmuenzer.android.scrollablennumberpicker.ScrollableNumberPicker.setValue(int)' on a null object reference

spisakova31 commented 6 years ago

did you initialize your npYob first?

ScrollableNumberPicker npYob = findViewById(R.id.npYob); npYob.setValue(1971);