Skip to content Skip to sidebar Skip to footer

Android Change Language Listener

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 be turned

Solution 1:

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.

Solution 2:

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".

Post a Comment for "Android Change Language Listener"