I'm writing app that support two language and I'm changing language with Change app Locale here my code :
Locale locale = new Locale("fa");
Locale.setDefault(locale);
Configuration configs = new Configuration();
configs.locale = locale;
getBaseContext().getResources().updateConfiguration(configs, getBaseContext().getResources().getDisplayMetrics());
And
in manifest I'm set android:supportsRtl="true"
These codes working in many Devices but in some devices not working . for example Texts not Translating but Direction change .
Tested Devices :
- Samsung J5Pro 2018 (android = 7.1): Worked
- Pixel 2 API 26 : Worked
- Samsung J7 2017 (android = 7): Worked
- Nexus 5 (android = 6) : Not Worked
- Samsung Galaxy G531 (android < lollipop) : Not Worked
recreate()
– Basil Battikhirecreate()
@Basil Battikhi – The Jake