Skip to content

Instantly share code, notes, and snippets.

@mplacona
Created May 5, 2019 11:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mplacona/6f2e2c1a2622cb57a8eb720d6f99ecd5 to your computer and use it in GitHub Desktop.
Save mplacona/6f2e2c1a2622cb57a8eb720d6f99ecd5 to your computer and use it in GitHub Desktop.
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
- val myData = DataSource()
- tvMagicNumber.text = myData.getMagicNumber().toString()
+ val model = ViewModelProviders.of(this).get(DataSource::class.java)
+ tvMagicNumber.text = model.getMagicNumber().toString()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment