Created
January 4, 2022 04:55
-
-
Save myungpyo/b5b618a0e0dbf00217e648989807e97d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MainActivity : AppCompatActivity() { | |
private val stateBinding = MainActivityStateBinding() | |
@StickyState | |
var stringProp: String = "aaa" | |
@StickyState | |
var intProp: Int = 1 | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContentView(R.layout.main_activity) | |
stateBinding.restore(stateHolder = this, stateStore = savedInstanceState) | |
} | |
override fun onSaveInstanceState(outState: Bundle) { | |
stateBinding.save(stateHolder = this, stateStore = outState) | |
super.onSaveInstanceState(outState) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment