Android Multiple Language Support for more than 3 activities -
i developing android app multiple language support
for language selection user need select language listview
issue: when user selects language, supposed applied activities in app in real, 2 activities strings changed
i have strings activities in languages
on listview item selection:
preferencemanager.getdefaultsharedpreferences(getapplicationcontext()).edit().putstring("lang", "hi").commit(); setlangrecreate("hi");
setlangcreate method
public void setlangrecreate(string langval) { configuration config = getbasecontext().getresources().getconfiguration(); locale = new locale(langval); locale.setdefault(locale); config.locale = locale; getbasecontext().getresources().updateconfiguration(config, getbasecontext().getresources().getdisplaymetrics()); recreate(); }
you need , work activities in application
locale locale = new locale(langval); locale.setdefault(locale); configuration config = new configuration(); config.locale = locale; getbasecontext().getresources().updateconfiguration(config, null);
Comments
Post a Comment