luisforque luisforque - 5 months ago 36
Android Question

How to create custom keyboard shortcut in Android Studio

I was working on Eclipse before, and there I created a template to quickly add logs inside Android.
So I started typing something, and then the IDE auto-completed to:

android.util.Log.d("SOME_TAG", "&{cursor}");

(one example, there were a few others)

Is there a similar feature in Android Studio?
I've seen the keymap settings, but could not find a way to create a custom element.

Thank you in advance.


Found this article that explains how to do so. The term I was looking for is Live Template

Go to File > Settings > Editor > Live Templates. Click the Android group, and press the plus button to add a new Live Template. You’ll want to choose an abbreviation to use the template, a description to remember what it does, and of course the code you’d like it to insert