Skip to content

Instantly share code, notes, and snippets.

@felipearimateia
Last active April 2, 2020 15:55
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save felipearimateia/ee651e2694c21de2c812063980b89ca3 to your computer and use it in GitHub Desktop.
Save felipearimateia/ee651e2694c21de2c812063980b89ca3 to your computer and use it in GitHub Desktop.
Toast Kotlin
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