IDE shortcuts can really make your development workflow fast and smooth. Android Studio comes perfectly in this aspect. Ideally, you should make it a habit to not pick up the mouse to perform most of your actions and slowly migrate towards a mouseless-workflow. Here are some of the most useful shortcuts for you to get started.
(Currently, only Mac shortcuts are available. Windows and Linux shortcuts coming soon.)
Must-Know Shortcuts:
Never-ever-ever forget these shortcuts.
Description | Shortcut |
---|---|
Find everything (like files, classes, symbols, etc.) | Shift + Shift |
Show a list of automatic fixes and IDE suggestions at the cursor | Option + Enter |
Rename all copies of the variable/method/class at the cursor | Shift + F6 |
List all usages of the variable/method/class at the cursor | Command + Option + F7 |
Generate code (like getters, setters, constructors, method overrides) | Command + N |
Search for any action in Android Studio | Command + Shift + A |
Find text occurencesin the current file (Enter = cycle through results, Esc. = cancel) | Command + F |
Show the list of recently used files in the IDE | Command + E |
Run the app or test | Control + R |
Frequently Used Shortcuts:
You will surely need these quite often.
Description | Shortcut |
---|---|
Search for and open any file by name | Command + Shift + O |
Move a piece of code in upward/downward direction | Command + Shift + Up/Down |
View javadoc of symbol at cursor in pop-up | F1 |
View definition of method at cursor in pop-up | Command + Y |
Search for and list any occurrences of text | Command + Shift + F |
Comment/Uncomment all selected lines (also works in xml files) | Command + / |
Show available parameters for current method (must be inside parentheses) | Command + P |
Format code to match Android Studio’s default style | Command + Option + L |
Delete a complete line at one go | Command + Delete |
Navigate through classes and methods | Command + Left Click |
Useful Shortcuts:
These can help you level up your development workflow.
Description | Shortcut |
---|---|
Go to next highlighted error in current file | F2 |
Go to the declaration of the variable/method/class at cursor | Command + B |
Go to given line number in current file | Command + L |
Duplicate current line | Command + D |
Search for and go to any symbol (incl. variables and methods) | Command + Option + O |
Show class structure in pop-up | Command + F12 |
List recently edited files in pop-up | Command + Shift + E |
View full refactor menu | Control + T |
Collapse/expand all code blocks | Command + Shift + +/- |
Collapse/expand individual code block | Command + +/- |
Insert new line below current cursor position | Shift + Enter |
Complete statement (add braces, parentheses, semi-colon) | Command + Shift + Enter |
View And Add Shortcuts in Android Studio
By going to Settings >> Keymap A window will popup showing All the Editor Actions with the their name and shortcuts. Some of the Editor Actions do not have shortcuts. So right click on that and add a new shortcut to that.