Code generation shortcut

Asked

Viewed 43 times

0

I wonder if there are any features in Android Studio where I type in a word and the IDE inserts an add-on (OBS: Where I report this, not the IDE itself). Example:

buttonobj -> Button btnexemplo = (Button) findViewById(R.id.btnexemplo);

When typing buttonobj+SPACE she would insert:

Button btnexemplo = (Button) findViewById(R.id.btnexemplo);

There is this feature in Netbeans, would anyone know if there is one in Android Studio? And where do I set it up?

1 answer

0


The name of this is Live Templates(fyk, in visual studio is snippets). To see/edit/add your live templates, go to Files > Settings > Editor > Live Templates choose what you want(android, for example). To add a new one just click on the green symbol on the side. To enter a live template in the code just click on the menu in Code > Insert Live Template or CTRL+J

Edit: Partial response in Soen

  • Thank you Marceloawq, that’s what I was looking for.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.