Remembering and using shortcuts frequently will reduce your work time a lot, esp. for repetitive tasks. Following are the most useful shortcuts/hotkeys in Android Studio:
Editor
- Alt + Left / Right: Switch to previous / next tab
- Ctrl + Alt + Left / Right: Reversed version of Alt + Left / Right
- Ctrl +Left / Right: Navigate within code word-by-word
- F2: Go to next syntax error
- Ctrl + F4 : Close tab. I personally don’t use this because I’m too familiar with Alt+F4 to close anything in Windows.
Search and Replace
- Double Shift: Multi-purpose searching. I use this shortcut a lot to search for files in res folder
- Ctrl + F : Find string in current file
- Ctrl + R : Find and replace string in current file
- Ctrl + Shift + F : Find string in project files
Code / Comment
- Ctrl + D : Duplicate current line of code
- Ctrl + Y : Remove current line of code
- Ctrl + + / – : Expand / collapse code block
- Alt + Shift + Left Click: Place an extra cursor.
- Ctrl + Left Click: Go to Class file of clicked object, method or property.
- Ctrl + / : Comment / uncomment a line of code
- Ctrl + Shift + / : Comment / uncomment a block of code
- Ctrl + Alt + L : Reformat code
- Shift + F6: Refactor name replacing. This can be used in project view and code lines
- Ctrl + Alt + O: Optimize imports. It basically removes unused imports.
Build/Debug
- Shift + F10 : Run selected build
- Shift + F9 : Debug selected build
- Ctrl + F2 : Stop build