5

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)
ouflak
  • 2,458
  • 10
  • 44
  • 49
TexGeek
  • 143
  • 2
  • 9
  • 1
    You first need to decode the stacktrace. See [Decoding Obfuscated Stack Traces](http://developer.android.com/tools/help/proguard.html#decoding). Also I can't see your line numbers. In your next release, also add following lines in your proGuard: `-renamesourcefileattribute SourceFile` & `-keepattributes SourceFile,LineNumberTable`. Now it will show line numbers (instead of **Unknown Source**) in your crash logs. – Sufian Jul 31 '15 at 06:20
  • i ran into the same problem, have you found any workaround here? – GvSharma Jan 17 '18 at 08:11

1 Answers1

1

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.

Stephan Branczyk
  • 9,363
  • 2
  • 33
  • 49
  • Stock Android doesn't have a change device's font style, in Samsung tab3 have Display --> Font --> FontStyle. – TexGeek Jul 31 '15 at 06:32
  • Are you correcting the menu name I used? Or are you saying that the Samsung tab3 is indeed running the stock Android os without TouchWiz? – Stephan Branczyk Jul 31 '15 at 07:25