重新执行onCreate方法
可以用来更新Theme
private static final String KEY = "current_theme";
private int theme;
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putInt(KEY, theme);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (savedInstanceState != null) {
theme = savedInstanceState.getInt(KEY);
setTheme(theme > 0 ? theme : R.style.DefaultCityPickerTheme);
}
setContentView(R.layout.activity_main);
themeBtn = findViewById(R.id.btn_style);
if (theme == R.style.DefaultCityPickerTheme){