Refreshing strings when chaning language programatically.

SiflouSiflou USMember ✭✭

Hey Guys,

In my app, I can change the language in the settings. I want that as soon as I select another language, that every button, textview, etc that has text setted with strings resources to refresh itself without me having to do it manually. I found a couple of solution on the internet that says to restart the activity, but it didnt work for me. Heres my code to change the language. Thanks a lot !

Claude

private void SaveLanguage(string aLanguage)
{
//Save preferences
ISharedPreferences preferenceManager = global::Android.Preferences.PreferenceManager.GetDefaultSharedPreferences(ApplicationContext);
global::Android.Content.ISharedPreferencesEditor preferenceEditor = preferenceManager.Edit();
preferenceEditor.PutString("Language", aLanguage);
preferenceEditor.Commit ();
}

Posts

  • ChrisHonselaarChrisHonselaar NLBeta ✭✭✭

    I found a couple of solution on the internet that says to restart the activity, but it didnt work for me.

    How so? What happens when you try it?

Sign In or Register to comment.