Skip to content

Instantly share code, notes, and snippets.

@myungpyo
Created January 4, 2022 04:55
Show Gist options
  • Save myungpyo/b5b618a0e0dbf00217e648989807e97d to your computer and use it in GitHub Desktop.
Save myungpyo/b5b618a0e0dbf00217e648989807e97d to your computer and use it in GitHub Desktop.
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