Issue
I know if I define two resources layout-en
and layout-fr
, Android selects the best-matching resources according to the user language selection in his device settings. Now I want to force Android to select a special resource according to my application settings.
For example the default language of my user's device is English and I have 2 options in my application for user to select his application language and assume he selects the french.
How can I force the Android to use fr
resources without any changes in user's device settings?
Solution
you can set the locale to french. Try something like this
Configuration c = new Configuration(getResources().getConfiguration());
c.locale = yourLocale;
getResources().updateConfiguration(c, getResources().getDisplayMetrics());
Answered By - stinepike
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.