I have Just one Activity that i need it with a different locale. Example my Default App Local is English and i want to Open an Activity where it content is Arabic. how can i force this activity to read from the values-ar ?
Asked
Active
Viewed 831 times
1
-
Possible duplicate of http://stackoverflow.com/questions/4985805/set-locale-programatically – Eric Bachhuber Feb 25 '17 at 14:48
-
I just want a specific locale for one Activity, not the whole application – user987760 Feb 25 '17 at 15:06
-
http://stackoverflow.com/questions/11705963/forcing-a-different-locale-works-only-for-top-activity-in-back-stack – Santosh Bachkar Feb 25 '17 at 20:38
1 Answers
0
update the locale by using the below code and change the locale to your preferred one and restart the activity
Configuration config = getBaseContext().getResources().getConfiguration();
config.locale = Globals.locale;
getBaseContext().getResources().updateConfiguration( config, null );
Intent restart = getIntent();
finish();
startActivity( restart );

Ajay Venugopal
- 1,544
- 1
- 17
- 30
-
Edit your answer with explanation. It was flagged as low quality post – Suraj Rao Feb 28 '17 at 05:07