Saturday, 25 October 2014

Android Studio Shortcuts for Windows

Using shortcuts make a developer more productive. Eclipse provides keyboard shortcuts for the most common actions so does Android Studio. Android Studio will be official development IDE and this tutorial will help in migrating from Eclipse to Android Studio.

1.   Quick Access
Action
Android Studio Key Command
To quickly open any class
CTRL + N
To quickly open any file
CTRL + SHIFT + N
Toggle tools (maximize/minimize code window).
CTRL + SHIFT + F12
To find all places where a particular class, method or variable is used in the whole project by positioning the caret at the symbol's name or at its usage in code.
ALT + F7


2.   Editing
Action
Android Studio Key Command
Basic code completion
CTRL + SPACE
Smart code completion
CTRL + SHIFT + SPACE
Parameter Info
CTRL + P
Quick documentation
CTRL + Q
External doc
SHIFT + F1
Generate code... (Getters, Setters, constructors etc)
ALT + INSERT
Override methods
CTRL + O
Surround with… (if..else, try..catch, for, synchronized, etc.)
CTRL + ALT + T
Comment/Uncomment single line
CTRL + /
Comment/Uncomment block code
CTRL + SHIFT + /
Select successively increasing code blocks
CTRL + W
Decrease current selection to previous state
CTRL + SHIFT + W
Reformat code
ALT + CTRL + L
Optimize imports
ALT + CTRL + O
Auto indent lines
ALT + CTRL + I
Duplicate current line/selected block
CTRL + D
Delete current line
CTRL + Y
Close active editor
CTRL + F4
Highlight usage in file
CTRL + SHIFT + F7
Find usages / Find usages in file
ALT + F7/ CTRL + F7
Show usages
ALT + CTRL + F7
Rename
SHIFT + F6
Change signature
CTRL + F6
Extract method
ALT + CTRL + M
Search everywhere
Double shift
Find
CTRL + F
Find next/previous
F3/SHIFT + F3
Replace
CTRL + R
Find in path
CTRL + SHIFT + F
Replace in path
CTRL + SHIFT + R

3.   Navigation
Action
Android Studio Key Command
Go to symbol
ALT + CTRL + SHIFT + N
Next/previous editor tab
ALT + RIGHT/LEFT
Previous tool window
F12
Editor from tool window
ESC
Hide active/last active window
SHIFT + ESC
Go to line
CTRL + G
Recent file
CTRL + E
Go to declaration
CTRL + B/ CTRL + CLICK
Go to implementation
ALT + CTRL + B
Open quick definition lookup
CTRL + SHIFT + I
Go to type declaration
CTRL + SHIFT + B
Go to super-method/class
CTRL + U
Go to previous/next method
CTRL + ARROW UP/DOWN
File structure pop up
CTRL + F12
Type hierarchy
CTRL + H
Method hierarchy
CTRL + SHIFT + H
Call hierarchy
ALT + CTRL + H
Edit/View source
F4/ CTRL + ENTER
Navigation Bar
ALT + HOME
Toggle bookmark
F11
Show bookmark
SHIFT + F11
Jump to source
F4
Command look-up (autocomplete command name)
CTRL + SHIFT + A

4.   Build/Debug/Run
Action
Android Studio Key Command
Build
CTRL + F9
Build and run
SHIFT + F10
Debug
SHIFT + F9
Toggle project visibility
ALT + 1
Navigate open tabs
ALT + left-arrow; ALT + right-arrow
View recent changes
ALT + SHIFT + C
Step over
F8
Step into
F7
Smart step into
SHIFT + F7
Step out
SHIFT + F8
Resume program
F9
Toggle breakpoint
CTRL + F8
View breakpoints
CTRL + SHIFT + F8

Shortcuts on Mac OS:
The above description uses the shortcuts based on Windows and Linux. Mac OS uses the Cmd key frequently instead of the Ctrl key.

Note:                                                    
View/Edit Keymap shortcuts - File -> Settings ->  Keymap
Check this link for migrating from Eclipse to Android Studio.