Skip to content

Instantly share code, notes, and snippets.

@wakwak3125
Created February 12, 2016 16:09
Show Gist options
  • Save wakwak3125/40693c0affaad9254763 to your computer and use it in GitHub Desktop.
Save wakwak3125/40693c0affaad9254763 to your computer and use it in GitHub Desktop.
Localeを指定して特定のstringを取得する方法 ref: http://qiita.com/wakwak3125/items/24f9c8388c75c1fabe0d
Resources resources = getResources();
Configuration configuration = resources.getConfiguration();
configuration.setLocale(Locale.ENGLISH); // ここで取得したいLocaleを指定します。
resources.updateConfiguration(configuration, null); // updateConfigurationを忘れずに…
// ここ以降で取得したstringはEngrishとなります。
// 取得したstringでなにかする。setText()とか…
configuration.setLocale(Locale.getDefault()); // 設定を元に戻すのを忘れないように。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment