Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android app crashed on Samsung devices after change of font style

I have a problem with an application when I tried to change the device's font (Samsung Galaxy Tab3), that being that my application crashes. In this case, the application is running in the background when I make the font change.

Steps:

  • Launch the app
  • Open device settings using status bar
  • Change device's font style
  • Return to the app using recent apps
  • Crash

I tried to test this scenario on other devices and can't reproduce it. My app crashed only on the Samsung device and only when the system font style changes.

Attached the log crash:

07-22 12:26:09.359: E/AndroidRuntime(8110): FATAL EXCEPTION: main
07-22 12:26:09.359: E/AndroidRuntime(8110): java.lang.NullPointerException
07-22 12:26:09.359: E/AndroidRuntime(8110):     at com.acs.nomad.app.widget.h.a(Unknown Source)
07-22 12:26:09.359: E/AndroidRuntime(8110):     at com.acs.nomad.app.b.ap.m(Unknown Source)
07-22 12:26:09.359: E/AndroidRuntime(8110):     at com.acs.nomad.app.d.v.onPause(Unknown Source)
07-22 12:26:09.359: E/AndroidRuntime(8110):     at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:890)
07-22 12:26:09.359: E/AndroidRuntime(8110):     at android.app.FragmentManagerImpl.removeFragment(FragmentManager.java:1129)
07-22 12:26:09.359: E/AndroidRuntime(8110):     at android.app.BackStackRecord.popFromBackStack(BackStackRecord.java:662)
07-22 12:26:09.359: E/AndroidRuntime(8110):     at android.app.FragmentManagerImpl.popBackStackState(FragmentManager.java:1450)
07-22 12:26:09.359: E/AndroidRuntime(8110):     at android.app.FragmentManagerImpl$2.run(FragmentManager.java:444)
07-22 12:26:09.359: E/AndroidRuntime(8110):     at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1401)
07-22 12:26:09.359: E/AndroidRuntime(8110):     at android.app.FragmentManagerImpl$1.run(FragmentManager.java:426)
07-22 12:26:09.359: E/AndroidRuntime(8110):     at android.os.Handler.handleCallback(Handler.java:615)
07-22 12:26:09.359: E/AndroidRuntime(8110):     at android.os.Handler.dispatchMessage(Handler.java:92)
07-22 12:26:09.359: E/AndroidRuntime(8110):     at android.os.Looper.loop(Looper.java:137)
07-22 12:26:09.359: E/AndroidRuntime(8110):     at android.app.ActivityThread.main(ActivityThread.java:4949)
07-22 12:26:09.359: E/AndroidRuntime(8110):     at java.lang.reflect.Method.invokeNative(Native Method)
07-22 12:26:09.359: E/AndroidRuntime(8110):     at java.lang.reflect.Method.invoke(Method.java:511)
07-22 12:26:09.359: E/AndroidRuntime(8110):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1043)
07-22 12:26:09.359: E/AndroidRuntime(8110):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:810)
07-22 12:26:09.359: E/AndroidRuntime(8110):     at dalvik.system.NativeStart.main(Native Method)
like image 965
TexGeek Avatar asked Nov 10 '22 08:11

TexGeek


1 Answers

Stock Android doesn't have a change device's font style

It must be a Samsung TouchWiz thing. May be, you should check out the Samsung specific SDKs.

But if I were you, I'd listen for the change in font style through a Broadcast Receiver. Find out which broadcast to listen to by using a Broadcast Monitor app from Google Play.

And then, I'd swallow the nullpointer exception and I'd restart the Activity whenever that happened. I realize this is a drastic action, but until you find out how the font style is causing the nullpointer exception, that's probably the only work around.

like image 143
Stephan Branczyk Avatar answered Nov 14 '22 22:11

Stephan Branczyk