?
在开发国际化的 Android 应用时候,有时需要指定某个 Locale
[代码]?java代码
1 | String languageToLoad? =? "de" ; |
2 | Locale locale =? new ?Locale(languageToLoad); |
3 | Locale.setDefault(locale); |
4 | Configuration config =? new ?Configuration(); |
5 | config.locale = locale; |
6 | getBaseContext().getResources().updateConfiguration(config,? null ); |
[代码]?AndroidManifest.xml
1 | < activity |
2 | ?? android:label = "@string/app_name" |
3 | ?? android:name = ".Dex" |
4 | ?? android:configChanges = "locale" > |