From the course: Android Studio Essential Training 2020

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Create and use live templates

Create and use live templates

From the course: Android Studio Essential Training 2020

Start my 1-month free trial

Create and use live templates

- [Instructor] In Android Studio, a live template is a combination of an abbreviation, and a bit of template code. When you type the abbreviation and press the tab key, it expands to the template. And then lets you fill in information. Here's some examples of live templates that Android Studio 4 already includes for use with Kotlin. If I type the word toast in lowercase, I see toast pop up in the auto-complete list. If I press tab, that expands, to a call to the makeText function of the Toast class. The cursor lands in the first parameter location, and I can type in something, that will be the context. Then when I press enter or return, the cursor will jump to the next place where I need to enter something. Here, I'm between a couple of double quotes, so I can type any string. After I've filled in all those variable values, the cursor will jump to the end of the template. Here's another example. Let's say I waned to trace some information and display a message…

Contents