Category Archives: Android Studio

(English) Create your own File Templates in Android Studio

Není k dispozici v češtině. For the sake of viewer convenience, the content is shown below in the alternative language. You may click the link to switch the active language.

You already know that you can make templates for code snippets in Android Studio. You can do same thing for whole files as well. And you probably use file templates even if you didn‘t yet created your own.
Everytime you create new file using New menu, you are creating files based on file templates.


Continue reading

(English) Android Studio Live Templates

Není k dispozici v češtině. For the sake of viewer convenience, the content is shown below in the alternative language. You may click the link to switch the active language.

One of best programming practices is DRY. Don’t repeat yourself. And yet we often write similar blocks of code over and over again. And sometimes it really cannot be avoided. You can save yourself lot of time when you meet Android live and file templates. In this post, I write about live templates but I am sure I will come back to file templates later.
So how can you use live templates? Simply type template abbreviation, press Tab and block of code defined in template comes up. There are many live templates already included in Android Studio, but you can also define your own. To see them go to Editor, Settings and Live Templates. There they are, by default sorted by a programming language of their use. Looking like this.
Continue reading