My application has a language setting feature. Now it works fine, but after restarting the device, the language returns to the original setting.
Does anyone have any ideas? Do I need to implement SharedPreferences
?
I got an answer. If your application has a language setting. and after restarting, the last language you changed will still be used by default. One way to make this work is to save the variable via SharedPreferences
; may be a string language.
Another thing, you need to have an initiate class. so whenever you open the application. he is able to call.
for instance
Setting appSettings = Setting.getInstance(getApplicationContext());
language = appSetting.getLanguage();
appSetting.setLanguage(language);
source share