Created
February 12, 2016 16:09
-
-
Save wakwak3125/40693c0affaad9254763 to your computer and use it in GitHub Desktop.
Localeを指定して特定のstringを取得する方法 ref: http://qiita.com/wakwak3125/items/24f9c8388c75c1fabe0d
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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