Skip to content

Instantly share code, notes, and snippets.

@kozmi55
Created August 3, 2018 11:20
Show Gist options
  • Save kozmi55/2a96ccd487fdf8b7266ab3990757446b to your computer and use it in GitHub Desktop.
Save kozmi55/2a96ccd487fdf8b7266ab3990757446b to your computer and use it in GitHub Desktop.
class MainActivity : AppCompatActivity() {
private val viewModel = UserViewModel()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val adapter = UserAdapter()
recyclerView.layoutManager = LinearLayoutManager(this)
recyclerView.adapter = adapter
viewModel.startUpdates()
}
override fun onDestroy() {
viewModel.stopUpdates()
super.onDestroy()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment