How to make a toast
Creating a TOAST has three ways: -
1.
Add this in XML –
android:onClick="show"
Main Activity –
fun show(view: View) {
Toast.makeText(this, "Button is clicked", Toast.LENGTH_SHORT).show()
}
2.
override fun onClick(v: View) {
Toast.makeText(v.context, "Button is clicked on interface function", Toast.LENGTH_LONG).show()
}
Comments
Post a Comment