Change Language of Android App programmatically using Java.

So here is from my side. it works perfectly for me.

**Follow these steps to change Language.**

1.Save your strings in folder like values-ur(URDU)

language strings

then convert your all strings to that language you have to convert.

2.Make a BaseActivity class and extend all your rest Activities to that BaseActivity class.

3.I have ExampleActivity that i want to translate its language.

simply extend your application to your BaseActivity class.

3.Make a LocalHelper class in which it change the layout-direction and strings.

4.In your App class attach base context.

5.In your build.gradle file add latest androidx SharedPreferences dependency.

6.In my caseI make my Own SharedPreferences class.

7.At last save the abbreviation of that language to SharedPreferences in my case Ihave spinner.

now all done……

Android Developer