public void changeLocale(String language, String country, String variant) { Configuration config = getBaseContext().getResources().getConfiguration(); if (!"".equals(language) && !config.locale.getLanguage().equals(language)) { permanentCache.locale_lang = language; permanentCache.locale_country = country; permanentCache.locale_variant = variant; permanentCache.save(); locale = new Locale(language, country, variant); Utils.setLocale(this, locale); } }
@Override public void onCreate() { super.onCreate(); timeUtils = new TimeUtils(this); db = new SQLiteDB(this); restManager = NetworkManager.getInstance(this); restService = restManager.getRestService(); permanentCache = PermanentCache.getInstance(this); permanentCache.restore(); if (permanentCache.locale_lang == null) { changeLocale("ru", "RUS"); } else { changeLocale( permanentCache.locale_lang, permanentCache.locale_country, permanentCache.locale_variant); } }