撮影
から:How to change language of app when user selects language?
public void setLocale(String lang) {
myLocale = new Locale(lang);
Resources res = getResources();
DisplayMetrics dm = res.getDisplayMetrics();
Configuration conf = res.getConfiguration();
conf.locale = myLocale;
res.updateConfiguration(conf, dm);
Intent refresh = new Intent(this, YOURACTIVITY.class);
startActivity(refresh);
finish();
}
あなたキャンは「ド」のように、あるsetLocaleメソッドに任意の有効な言語の文字列を渡すか、「それを」、しかし、あなたは活動を再開する必要があります。
戻るボタンを押してもアプリケーションの動作がわかりません。それはあなたの「古い」の活動を開始した場合は、あなたの活動を再開しながら、これを試してみてください。ここ
public void setLocale(String lang) {
myLocale = new Locale(lang);
Resources res = getResources();
DisplayMetrics dm = res.getDisplayMetrics();
Configuration conf = res.getConfiguration();
conf.locale = myLocale;
res.updateConfiguration(conf, dm);
Intent refresh = new Intent(this, YOURACTIVITY.class);
refresh.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(refresh);
}
関連情報:http://stackoverflow.com/questions/2900023/change-language-programmatically-in-をアンドロイド –