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