Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Null pointer exception in suggestions popup window on Samsung Galaxy Android 7

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)
like image 488
Craig McMahon Avatar asked Jun 26 '17 20:06

Craig McMahon


People also ask

What is null pointer exception in Android?

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 do you stop null pointer exception?

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.

When we get Null pointer exception?

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.


1 Answers

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~

like image 195
Sagi Mymon Avatar answered Sep 19 '22 09:09

Sagi Mymon