Created
January 4, 2022 04:58
-
-
Save myungpyo/01ac3f4d7fa97218436269fe0b9b618d 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
package io.github.myungpyo.simplekspsample.sample | |
import android.os.Bundle | |
class MainActivityStateBinding { | |
fun save(stateHolder: MainActivity, stateStore: Bundle) { | |
with(stateHolder) { | |
stateStore.putString("StickyState_stringProp", stateHolder.stringProp) | |
stateStore.putInt("StickyState_intProp", stateHolder.intProp) | |
} | |
} | |
fun restore(stateHolder: MainActivity, stateStore: Bundle?) { | |
stateStore ?: return | |
stateHolder.stringProp = stateStore.getString("StickyState_stringProp") ?: stateHolder.stringProp | |
stateHolder.intProp = stateStore.getInt("StickyState_intProp") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment