Created
July 6, 2023 09:02
-
-
Save senamit2708/cca70e2b171f3eccbaad7f236834c816 to your computer and use it in GitHub Desktop.
multiple button with "when"
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
| class SealedLearningFrag: Fragment(), View.OnClickListener{ | |
| override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | |
| super.onViewCreated(view, savedInstanceState) | |
| binding.btnEmployee.setOnClickListener(this) | |
| binding.btnManager.setOnClickListener(this) | |
| binding.btnJuniorDev.setOnClickListener(this) | |
| } | |
| override fun onClick(view: View?) { | |
| when(view){ | |
| binding.btnEmployee ->{ | |
| } | |
| binding.btnManager ->{ | |
| } | |
| binding.btnJuniorDev -> { | |
| } | |
| else -> { | |
| Toast.makeText(requireContext(), "nothing selected", Toast.LENGTH_SHORT).show() | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment