How do you display a Toast using Kotlin on Android?

前端 未结 15 2233
遇见更好的自我
遇见更好的自我 2021-01-30 16:08

In different Kotlin examples for Android I see toast("Some message...") or toastLong("Some long message"). For example:



        
15条回答
  •  时光取名叫无心
    2021-01-30 16:11

    Android Toast for Kotlin

    Activity

    Toast.makeText(applicationContext, "message...", Toast.LENGTH_SHORT).show()
    

    Fragment

    Toast.makeText(activity, "message...", Toast.LENGTH_SHORT).show()
    

提交回复
热议问题