My application is running with two language i.e English and Spanish, For this i maintain two folders for values i.e values and values-sp.
I have one button in my SettingsActivity when ever i clicked on that the total application changed to selected language for that i have written the attached code.
My Problem is when ever i clicked the button and press back button app is showing black screen for some time then it is appearing.
in every activity of on resume i am calling onCreate again for refreshing view. even though i have done this the black screen is appearing.
Can any one please help me to get out of this.
Thanks in advance.
My code is
english.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v)
{
languagePopup.dismiss();
Locale locale2 = new Locale("en");
Locale.setDefault(locale2);
Configuration config2 = new Configuration();
config2.locale = locale2;
getBaseContext().getResources().updateConfiguration(config2, getBaseContext().getResources().getDisplayMetrics());
changLanguae();
if(language.equalsIgnoreCase("English"))
Constants.isLanguageChanged=false;
else
Constants.isLanguageChanged = true;
}
});
spanish.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View v)
{
languagePopup.dismiss();
Locale locale2 = new Locale("es");
Locale.setDefault(locale2);
Configuration config2 = new Configuration();
config2.locale = locale2;
getBaseContext().getResources().updateConfiguration(config2, getBaseContext().getResources().getDisplayMetrics());
changLanguae();
if(language.equalsIgnoreCase("Spanish"))
Constants.isLanguageChanged=false;
else
Constants.isLanguageChanged = true;
}
});