android change language listener

后端 未结 2 1074
青春惊慌失措
青春惊慌失措 2020-12-15 20:26

Language can be changed in

Home > Menu > Settings > Locale & text > Select locale

I am wondering how can I detect such change? My application is seems to

相关标签:
2条回答
  • 2020-12-15 21:14

    An Intent is broadcast for this:

    http://developer.android.com/reference/android/content/Intent.html#ACTION_LOCALE_CHANGED

    You can register a BroadcastReceiver in your manifest to handle it.

    0 讨论(0)
  • 2020-12-15 21:20

    http://developer.android.com/guide/topics/manifest/activity-element.html#config says:

    android:configChanges Lists configuration changes that the activity will handle itself. When a configuration change occurs at runtime, the activity is shut down and restarted by default, but declaring a configuration with this attribute will prevent the activity from being restarted. Instead, the activity remains running and its onConfigurationChanged() method is called.

    Note: Using this attribute should be avoided and used only as a last-resort. Please read Handling Runtime Changes for more information about how to properly handle a restart due to a configuration change.

    Any or all of the following strings are valid values for this attribute. Multiple values are separated by '|' — for example, "locale|navigation|orientation".

    0 讨论(0)
提交回复
热议问题