Sunday, 23 April 2017

Easy Code Tricks Android Development - Part - II

Click to review the Part I 

Here we go through the ten easy tricks to reduce our code time.  Android Studio IDE's facilitates our work to get done in a quick time.

Ctrl+N, type the class name to reach out the files directly from any where in the IDE and Ctrl+Shift+N, this pulls down all the classes, interfaces and .xml files as well

Choose from the last copy/pastes (manage your clipboard):  Mac: cmd + shift + v (Windows / Linux: ctrl + shift + v). By default there are 5 last copy/paste items.

Live Code Template: Mac: cmd + j (Windows / Linux: ctrl + j)

Enable multicursor feature: Mac: cmd + g (alt + j for Windows/Linux). press the shortcut to choose the similar text and get the cursor to the texts, while editing will update those values simultaneously.

Goto super class: Mac: cmd + u (Windows / Linux: ctrl + u). For instance, you override some method. When your caret in on the method’s name and press the shortcut, you will be redirected to the parent method.

Goto Declaration: Mac: cmd + b (Windows / Linux: ctrl + b). Place cursor on the word and use the shortcut, It allows you to quickly check and go to a declaration of a class, method or a variable.

Goto type declaration: Mac: cmd + shift + b (Windows / Linux: ctrl + shift + b).  Place cursor on the word and use the shortcut,  It allows you to quickly navigate to its type declaration.

Move and navigate between opened tabs:
Mac: cmd + shift + [ (move left) or cmd + shift + ] (move right)
Windows/Linux: alt + ← or →

Close a current tab:  Mac: cmd + w | Windows/Linux: ctrl + F4

Move hardcoded strings to resources: option + return (Windows / Linux: alt + enter). The shortcut must be used when a caret is on a text.

No comments: