prk
prk

Reputation: 338

Font Change restarts application in android

When I change the system font on an android device, my app is getting restarted (not just current activity). I am sure of this as the pid itself is different.

Is there any way to prevent application restart?

This question is related to: Handle runtime activity configuration when font change

As described there, there is no configChanges attribute which can be used to handle system font change (fontScale works only for font size change).

Upvotes: 3

Views: 2848

Answers (2)

Triode
Triode

Reputation: 11357

You should add the below line in your manifest. But you have to handle the configuration change by yourself.android:configChanges="fontScale"

Handling Runtime Changes

Upvotes: 3

Tomer B
Tomer B

Reputation: 5475

I think it is the same as when you change the orientation of your phone. The activity restarts. You can store information as needed by overriding protected void onSaveInstanceState(Bundle savedInstanceState) and protected void onRestoreInstanceState(Bundle savedInstanceState).

More info and examples can be found in this guide: http://developer.android.com/training/basics/activity-lifecycle/recreating.html

Upvotes: 0

Related Questions