Back to project page android.
The source code is released under:
GNU General Public License
If you think the Android project android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package de.nico.ha_manager; //from w w w . ja va 2s . c o m /* * Author: Nico Alt * See the file "LICENSE.txt" for the full license governing this code. */ import android.app.Application; import android.content.Context; import android.content.SharedPreferences; import android.content.res.Configuration; import android.preference.PreferenceManager; import android.text.TextUtils; import java.util.Locale; public class HWManager extends Application { private static void updateLanguage(Context c) { SharedPreferences prefs = PreferenceManager .getDefaultSharedPreferences(c); String lang = prefs.getString("locale_override", ""); updateLanguage(c, lang); } private static void updateLanguage(Context c, String lang) { Configuration cfg = new Configuration(); if (!TextUtils.isEmpty(lang)) cfg.locale = new Locale(lang); else cfg.locale = Locale.getDefault(); c.getResources().updateConfiguration(cfg, null); } @Override public void onCreate() { updateLanguage(this); super.onCreate(); } }