


Then the activity will reload the resources with the correct locale. Second, you can call activity.recreate() to restart currently loaded activity.First, you can just update the text or any other language dependent resources one by one.You have two options to update currently visible layout: Other activities will not require any modifications at all. After that you just need to take care of the activity or fragment which includes the language change buttons. In your activity override attachBaseContext and call LocaleHelper.onAttach(). You should update currently visible UI properly according to the selected language.Your application will not remember your language change after it is closed or recreated during the configuration change.There are some difficulties which you have to overcome to change the language programmatically.

Here is the appropriate way of changing the locale of the application: To do that I will outline the details of changing the language of your application programmatically on the fly. However, sometimes there is some business requirements that you need to implement. And most of the time this behaviour is enough for common applications. And therefore, you need to solve this situation in some other ways.Īndroid by default uses the locale of the device to select the appropriate language dependent resources. However, Android OS does not directly support this behaviour. While developing your awesome application, sometimes you are required to add a feature to change the language of your app on the fly. Update: Published locale-helper as a library which can be found at
