To save the boolean value representing the Fragment display state, define a key for the Fragment state to use in the savedInstanceState Bundle. Add this member variable to MainActivity: static final String STATE_FRAGMENT = "state_of_fragment"; Add the following method to MainActivity to save the state of the Fragment if the configuration changes:
Fragments – React Fragments declared with the explicit
Android Kotlin Fundamentals 03.1: Create a fragment A fragment is a modular section of an activity. A fragment has its own lifecycle and receives its own input events. Use the
Sentence fragment definition, a phrase or clause written as a sentence but lacking an element, as a subject or verb, that would enable it to function as an independent sentence in normative written English. See more.
Feb 12, 2020