Last active
October 7, 2017 22:01
-
-
Save gcherubini/262f78d5ec3b5fde092a86872ef572bf to your computer and use it in GitHub Desktop.
Simplifying Android activities with Kotlin - Btn Send Actions
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
private fun btnSendActions(binding: ActivityHomeBinding) { | |
if (binding?.editTextUserName?.text?.toString()?.isNotBlank()!!) { | |
val intent = Intent(this, WelcomeActivity().javaClass) | |
intent.putExtra(EXTRA_PARAM_USER_NAME, binding.editTextUserName.text.toString()) | |
startActivity(intent) | |
return | |
} | |
val alert = AlertDialog.Builder(this).create() | |
alert.setMessage("Please, fill input correctly.") | |
alert.setButton(Dialog.BUTTON_POSITIVE, "OK") { _, _ -> alert.dismiss() } | |
alert.show() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment