Last active
April 2, 2020 15:55
-
-
Save felipearimateia/ee651e2694c21de2c812063980b89ca3 to your computer and use it in GitHub Desktop.
Toast Kotlin
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
fun Activity.toast(message: CharSequence, duration: Int = Toast.LENGTH_SHORT) { | |
Toast.makeText(this, message, duration).show() | |
} | |
class MainActivity : Activity(){ | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
toast("Hello, Kotlin!") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment