Created
November 17, 2018 12:37
-
-
Save YashishDua/5d359cacb55e7628d2bb98fd3a9f80aa to your computer and use it in GitHub Desktop.
This file contains 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
class WallDetailFragment : Fragment() { | |
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") | |
model.data.observe(this, Observer<Item> { item -> | |
// Update the UI | |
}) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment