Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
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?) {
toast("Hello, Kotlin!")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment