Hi mot12,
  i was fighting with similar problem few days ago and succesfully
solved. so my solution which may help you too ...

String lang = Settings.getLanguage();
Resources res = activity.getResources();
DisplayMetrics dm = res.getDisplayMetrics();
Configuration config = res.getConfiguration();

String loca = "";
if
(lang.equals(activity.getString(R.string.pref_misc_locale_lang_en_value)))
{
  loca = "en";
} else if
(lang.equals(activity.getString(R.string.pref_misc_locale_lang_cs_value)))
{
  loca = "cs";
}

Locale locale = new Locale(loca);
Locale.setDefault(locale);

config.locale = locale;
res.updateConfiguration(config, dm);

I'm giving user posibility to choose language from app settings. When
my app start (or restart after lang change, i check which lang is
selected by "Settings.getLanguage()" and then set selected lang (in
this case czech or english). One important think is that in ALL my
Activities in manifest file, I have "android:configChanges="locale".

Everything works perfectly, for me ...

Hope this help

On Feb 13, 9:00 pm, mot12 <[email protected]> wrote:
> Hi,
>
> Any help on this would be much appreciated.
>
> I would like to give the users of my app the possibility of selecting
> a language from within the application. All languages are supplied the
> standard way via the values-?? resource directory.
>
> However, I don't want Android to select which resource directory to
> use but let the user decide instead.
>
> Any ideas how to accomplish that?
>
> The rationale for this:
> - some languages are not supported by the Android framework and can
> not be selected as a locale via the system settings
> - if you buy a phone in Spain, it will typically not have a system
> setting for Russian language, if you purchase in Russia, you will have
> that setting. So a Russian person in Spain would prefer using the
> Russian language included with the app, but can't access it
>
> thanks for any suggestions,
> Martin

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to