I've got a setting screen with preferences in my app.
I use PreferenceFragmentCompat and usual AppCompatActivity. When I change state of some preference(f.e. SwitchPreferenceCompat) and tap on it then the Android preference framework will change its internal state and upgrade preference UI. Thats pretty good.
In one usecase I have to change internal preference state manually and then I must change preference UI manually but I didn't find any invalidate-method to upgrade preference-UI.
I load preference screen with its children and them states in onCreatePreferences
override fun onCreatePreferences(bundle: Bundle?, rootKey: String?) {
setPreferencesFromResource(R.xml.preferences, rootKey)
}
but when I return on that screen(after another activity is finished) I should refresh preference-UI according to its new internal state.
Is there anyone who khows how to do it manually (I'm aware that this workflow is not native)?