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.
attachBaseContext
as I would usually do. Hope this helps – Genip