Android: how do I prevent class variables being cleared on orientation change [duplicate]
问题 This question already has answers here : Android save state on orientation change (2 answers) Closed 3 years ago . I have a main activity which has two configurations, one which will display a fragment which is locked to portrait orientation. When a button is clicked on this fragment, a fragment replaces it, however this new fragment can be displayed landscape with a second fragment side-by-side. This all works fine, however I am intercepting back-navigation in the second state so that I can