Last active
July 6, 2017 05:37
-
-
Save SUPERCILEX/feeb14b6381c4d0f0c44a72622752534 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
val hadModel = ViewModelProviders.of(this).has(MyViewModel::class.java) | |
val model = ViewModelProviders.of(this).get(MyViewModel::class.java) | |
if (!hadModel) { | |
if (savedInstanceState != null) { | |
model.init(savedInstanceState.getMyStuff()) | |
} else { | |
model.init(arguments.getMyStuff()) | |
} | |
} | |
useModel() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment