Created
March 15, 2019 13:10
-
-
Save alz-ahm/28b87f3c9aa905516ce8052f032c8d91 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
//Without extension | |
Toast.makeText(this, “Hello”, Toast.LENGTH_SHORT).show() | |
//With Extension | |
showToast("Hello") | |
//Extension Method | |
fun Context.showToast(text: CharSequence, duration: Int = Toast.LENGTH_SHORT) { | |
Toast.makeText(this, text, duration).show() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment