I have a main Activity
which contains of approximately 90 percent of my app Fragments
. After user, logged in on login activity I add the main fragment on onCreate()
of the Master Activity.
The issue is when in SettingFragment
(which is a PreferenceFragment
) i change the locale of the app , I have to recreate the main Activity
so on onCreate()
it loads the main fragment again which is not desirable (I want to remain on setting with new language).
What is the best way to handle such situation? I have thought of checking SettingFragment
visibility from FragmentManager
but on recreation it cannot find the settingFragment and it returns always null. Another way might be writing on sharedPreferences
to check if MainFragment loaded or not but I am not sure of what's the best state to write or read to.