TL;DR We want to change the locale (API 24+) for a to be displayed fragments while all these fragments are going to be inside the same activity.
We are using NavHostFragment
, and start_up_nav_graph.xml
.
This graph has multiple fragments i.e. Log-in, Onboarding, GDPR ..etc
In this flow, If after logging in we find that you are a German user, we try to change your locale to German. In the current scenario, all the up-coming fragments (such as onboarding and GDPR) are going to be displayed in the device's locale, not German.
We can't use attachBaseContext
in the activity like this answer, because the activity has already been created.
I'm experiencing same pain brother. i tried to do
NavigationUI.setupWithNavController(mToolbar,mNavController, mAppBarConfiguration);
but this is also not helping because Toolbar Title and Navigation Drawer items are using old resources and when i'm doing activity.recreate()
then it's actually happening but when you close app and restart it again same problem...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With