Created
June 19, 2021 18:31
-
-
Save Dzendo/0eb95f9a8004ddd7a1ab98755a1e6d38 to your computer and use it in GitHub Desktop.
observeEvent example
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
viewModel.starClicked.observeEvent(viewLifecycleOwner) { | |
Toast.makeText(activity, it, Toast.LENGTH_LONG).show() | |
} | |
viewModel.keyBoard.observeEvent(viewLifecycleOwner) { | |
it?.let { | |
if (it) showKeyboard() | |
else hideKeyboard() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment