Skip to content

Instantly share code, notes, and snippets.

@YashishDua
Last active January 22, 2019 05:01
Show Gist options
  • Save YashishDua/05a355d69a533f5f4d8281a35d6120f5 to your computer and use it in GitHub Desktop.
Save YashishDua/05a355d69a533f5f4d8281a35d6120f5 to your computer and use it in GitHub Desktop.
class WallFragment : Fragment() {
private lateinit var itemSelector: Selector
private lateinit var model: SharedViewModel
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
model = activity?.run {
ViewModelProviders.of(this).get(SharedViewModel::class.java)
} ?: throw Exception("Invalid Activity")
itemSelector.setOnClickListener { item ->
//model.data.value = item
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment