strangely, calling onSaveInstanceState at this time races with
some other thing reacting to the change making fragment manager
crash with "fragment transaction already in progress"
regardless, Actvity.recreate() is designed just for this job
scheduleDataRetrievalIfStale(newValue);
}
private void profileThemeChanged() {
scheduleDataRetrievalIfStale(newValue);
}
private void profileThemeChanged() {
- Bundle bundle = new Bundle();
- onSaveInstanceState(bundle);
-
storeThemeIdInPrefs(profile.getThemeHue());
storeThemeIdInPrefs(profile.getThemeHue());
- // restart activity to reflect theme change
- finish();
-
// un-hook all observed LiveData
Data.profile.removeObservers(this);
Data.profiles.removeObservers(this);
Data.lastUpdateDate.removeObservers(this);
// un-hook all observed LiveData
Data.profile.removeObservers(this);
Data.profiles.removeObservers(this);
Data.lastUpdateDate.removeObservers(this);
- Intent intent = new Intent(this, this.getClass());
- intent.putExtra(BUNDLE_SAVED_STATE, bundle);
- startActivity(intent);
}
private void storeThemeIdInPrefs(int themeId) {
// store the new theme id in the preferences
}
private void storeThemeIdInPrefs(int themeId) {
// store the new theme id in the preferences