Created
November 29, 2017 10:21
-
-
Save engr-erum/3e15ae11f98ddee740a517aad1cfa1f9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// when i m updating language so its continously launching activity ... how will i resolve this issue ? | |
private void updateLanguageBasedOnLocalStorage() { | |
languageSelection = SharedPreferencesManager.getSharedPreferenceInstance(context).getSharedPreferenceString(context, getString(R.string.str_language)); | |
if (TextUtils.isEmpty(languageSelection)) { | |
languageSelection = getString(R.string.str_en); | |
} | |
setLocal(languageSelection); | |
} | |
public void setLocal(String lang) { | |
local = new Locale(lang); | |
Resources res = getResources(); | |
DisplayMetrics dm = res.getDisplayMetrics(); | |
Configuration conf = res.getConfiguration(); | |
conf.locale = local; | |
res.updateConfiguration(conf, dm); | |
setAllFieldsEmpty(); | |
SharedPreferencesManager.getSharedPreferenceInstance(context).setBoolean(context, getString(R.string.str_language_applied), true); | |
finish(); | |
Intent myIntent = new Intent(LoginActivity.this, LoginActivity.class); | |
startActivity(myIntent); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment