Gaurav
Gaurav

Reputation: 667

Stop activity restart on font change

Whenever I change font activity starts from onCreate(). How can I stop this?

Upvotes: 2

Views: 2819

Answers (1)

kaspermoerch
kaspermoerch

Reputation: 16560

The reason for this is that changing the font scale fires a configuration change. You can see a list of that things that fire these configuration changes here.

To avoid it, you could add the attribute android:configChanges="fontScale" - but you would then need to handle that configuration change yourself by overriding onConfigurationChanged().

I advise that you read about Handling Runtime Changes before you proceed.

Upvotes: 7

Related Questions