AndreiBogdan
AndreiBogdan

Reputation: 11164

Create shortcuts for methods in Android Studio

Is there a way to generate my out shortcuts, like sout or soutv and so on, in Android Studio ? I'd like to make something like mab and then press ctrl+spaced which will generate a predefined method and then let me fill out the params for it. (so basically the same as sout)

Upvotes: 0

Views: 150

Answers (1)

Blundell
Blundell

Reputation: 76506

Yes you can, they're called Live Templates,

here is an example of someone doing it https://github.com/manhluong/peng/blob/master/PengAndroid/src/com/luongbui/peng/android/InstallWatchAppTask.java#L50

Here is the IntelliJ docs

https://www.jetbrains.com/idea/help/live-templates.html

To create a new template from scratch

In the Settings dialog, open the Live Templates page, and expand the template group where you want to create a new template.

Click add (+). A new template item is added to the group and the focus moves to the Template Text area.

Specify the new template abbreviation, type the template body, define the variables and the template group, configure the options, as described in the template modification procedure.

Click OK when ready.

lt

Upvotes: 1

Related Questions