Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio shortcut for autocomplete Toast(Kotlin)

I have a problem with the newest version of Android Studio(> 3) to use the autocomplete for Toast with Kotlin.

In older versions with Java, it was like typing "Toast", then pushing "Tab" button on keyboard to autocomplete this.

Now, in the versions of Android Studio > 3 and Kotlin it is not working.

Anyone know how to achive this?

like image 323
K.Os Avatar asked Dec 23 '17 17:12

K.Os


2 Answers

Go to Settings > Live Templates. Under Android, find Toast and select it. At the bottom of settings dialog, it says Applicable in Java. Click Change button next to it and select Statement under Kotlin. Done.

like image 157
gitter Avatar answered Oct 23 '22 05:10

gitter


This is not an exact answer for your question but if you are using the anko library from Jetbrains (and why wouldn't you?) you can simply show a toast with the line toast("some text")

like image 43
Ivan Wooll Avatar answered Oct 23 '22 05:10

Ivan Wooll