12

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)
Craig McMahon
  • 1,550
  • 1
  • 14
  • 36
  • Null pointer exception sometimes because of you delete a view that is connect to Java file ( findViewById ), but you forgot to delete that line of code in Java file. – Infinite Loops Jun 26 '17 at 23:25
  • 1
    The same problem. Hundreds of reports. Samsung was always very good in bug extensions for Android making. – Quark Jul 12 '17 at 19:59
  • Do you have a solution (except of removing TYPE_TEXT_FLAG_NO_SUGGESTIONS)? – Jolinar Jul 12 '17 at 20:55
  • @Tron Do you also use `TYPE_TEXT_FLAG_NO_SUGGESTIONS`? – Craig McMahon Jul 13 '17 at 09:26
  • Yes, I have two EditTexts in a layout and one of them has `TYPE_TEXT_VARIATION_VISIBLE_PASSWORD` and `TYPE_TEXT_FLAG_NO_SUGGESTIONS` flags. I can't test the exact behavior (got only stacktraces and users 'reviews'). – Quark Jul 13 '17 at 14:05

3 Answers3

0

If your view is extending Activity try extending AppCompatActivty instead, hope it resolves your issue.

Dev
  • 139
  • 2
  • 3
-1

It's possible a bug in Samsung Android system. For this kind of platform's bug I believe, I would like to use try{} catch{} to handle them, then the app should be able to sustain at least. Of course, if the exception happens during your application booting sequence, then it's impossible to handle it with try{} catch..., it's better to locate the root cause and find a true solution to fix or work around it. But if the exception happens in your application feature, it's easy to find a way to handle it after you catch this exception, then your application will not crash. I like to use the "try...catch" to handle this kind of unexpected situations.

Clock ZHONG
  • 875
  • 9
  • 23
  • 2
    There is probably no way, how you can catch this. – Quark Jul 12 '17 at 20:03
  • 1
    Use of `try/catch` here is not helpful. The crash happens completely outside of the OP's code. The crash occurs in Samsung code which is called directly from Android code. – David Wasser Mar 28 '18 at 15:55