NPE in ChangeCurrentByOneFromLongPressCommand (on Samsung devices with Android 4.3)

Using a pair of android.widget.NumberPicker in my view of the Android App, and I get the following message when I hold down one of the numbers arrows: -

 FATAL EXCEPTION: main java.lang.NullPointerException at android.widget.NumberPicker$ChangeCurrentByOneFromLongPressCommand.run(NumberPicker.java:2245) at android.os.Handler.handleCallback(Handler.java:730) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:5419) 

Anyone have any ideas on how I can stop this problem?

UPDATE: From the comments it still seems that this exception occurred only on Samsung devices with Android 4.3 .

+42
java android numberpicker
Dec 30 '14 at 9:44
source share
2 answers

This is how I use NumberPicker in my application, and it works well for me:

Java code in your onCreate ():

 NumberPicker numberpicker = (NumberPicker) findViewById(R.id.np_from); numberpicker.setMaxValue(100); numberpicker.setMinValue(16); 

XML code :

  <NumberPicker android:id="@+id/np_from" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="20dp" android:width="100dip" /> 

Hope this helps.

+1
Apr 13 '14 at 7:47
source share

http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/4.3_r1/android/view/View.java#View.clearAccessibilityFocus%28%29

Looking at all versions 4.3, it is pretty clear that the code most likely calls clearAccessibilityFocus ().

Assuming the exact line numbers, I would look for a possible reason there. Nothing jumps at me, in fact most of the access has good null checks.

0
Apr 24 '14 at
source share



All Articles