Android Studio Kotlin Live Templates

How to make your life as an Android developer easier with Live Templates

Yanneck Reiß
Geek Culture

--

Photo by Photo:N from Pexels

Live Templates are a powerful tool to facilitate the life of a developer. The feature is included in Android Studio and is available for Kotlin since version 4.0.0.

Summarized, Live Templates provide a shortcut to easy access often used code snippets with the option for customization on demand. If you didn’t know of this feature before and you are an Android Developer I can almost guarantee you that you unknowingly already used it.

Code snippets defined in form of Live templates can be included in the auto code completion (IntelliSense). Out of the box, there are already plenty of them provided for you within Android Studio 4.0.0 and above.

Live Templates

To look up which Live Templates Android Studio already offers you for your Kotlin code, go to File → Settings → Editor → Live Templates → Kotlin. Besides the Kotlin tab, you can also take a look at the AndroidKotlin tab.

Live Templates in the settings

For example, you are tired of writing the same code when you just want to show a Toast

--

--