I'm seeing an unusual crash occur regularly in my app, but only on Samsung Galaxy devices running Android 7. Since my app's code doesn't feature in the stacktrace, I'm finding it very hard to track down short of going out and buying one of these expensive devices. Are there any clues to follow here?
It appears to be an internal bug happening inside the suggestions popup associated with an input control, presumably the EditText
that features on my app's primary screen. That EditText
should not be presenting suggestions, since I'm also using
searchBox.setImeOptions(EditorInfo.IME_ACTION_SEARCH | EditorInfo.IME_FLAG_NO_EXTRACT_UI);
searchBox.setInputType(EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
The stacktrace follows:
java.lang.NullPointerException:
at android.widget.Editor$SuggestionsPopupWindow.initContentView(Editor.java:3729)
at android.widget.Editor$PinnedPopupWindow.<init>(Editor.java:3390)
at android.widget.Editor$SuggestionsPopupWindow.<init>(Editor.java:3675)
at android.widget.Editor.replace(Editor.java:431)
at android.widget.Editor$3.run(Editor.java:2354)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6776)
at java.lang.reflect.Method.invoke(Native Method:0)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)
What is NullPointerException? It is a run-time exception that arises when an application or a program tries to access the object reference(accessing methods) which has a null value stored in it.
How to avoid the NullPointerException? To avoid the NullPointerException, we must ensure that all the objects are initialized properly, before you use them. When we declare a reference variable, we must verify that object is not null, before we request a method or a field from the objects.
The NullPointerException occurs due to a situation in application code where an uninitialized object is attempted to be accessed or modified. Essentially, this means the object reference does not point anywhere and has a null value.
It seems like a bug in Samsung devices. Look here: http://developer.samsung.com/forum/thread/android-app-crash-because-of-null-pointer-exception-on-setting-onclick-listener-in-editor-class/201/309993?boardName=SDK&startId=zzzzz~
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With