- 1 Android Studio ShortCut | Develop Faster
- 1.1 General Shortcut Keys
- 188.8.131.52 Switch between tabs and tool window
- 184.108.40.206 Add to favorites
- 220.127.116.11 Save All
- 18.104.22.168 Inspect Current File with current Profile
- 22.214.171.124 Navigation & Searching
- 126.96.36.199 Replace
- 188.8.131.52 Find class
- 184.108.40.206 Jump to source
- 220.127.116.11 Open type hierarchy
- 18.104.22.168 Open method hierarchy
- 22.214.171.124 Open call hierarchy
- 126.96.36.199 Go to line
- 188.8.131.52 Search Every Where
- 184.108.40.206 Find next
- 220.127.116.11 Find previous
- 1.2 Writing code
- 1.3 Comment Specific
- 1.4 Build and Run
- 1.5 Build and run
- 1.6 Apply changes – Instant Run
- 1.7 Debugging
- 1.8 Version control
- 1.9 Related Posts
- 1.1 General Shortcut Keys
Android Studio ShortCut | Develop Faster
If you have been following my articles over the years, I advocate on developing a best practice while you code. Using Shortcut is a very good way to improve your code. Like any Art, programming also is a way of expressing your ideas. It could be as small as creating your custom shortcuts to develop your style of writing a code, or even could be your way of naming a function or even favoring one design pattern to another.
In this article, I will be quickly summarising my most useful and top Android Studio Shortcuts which you will have to make it a part of your coding style.
It takes an average developer close to approximately 8 days in a year(Assuming 48-50 hour work week), in switching between a mouse and a keyboard, the shortcuts are definitely going to cut your development time. You can scroll down now to grab the Cheat Sheet PDF, or stay on and read every Shortcut with its related Action.
The below Android Shortcut keys are compiled as “most used/useful”. There are several more keys that may be of use to you. I will put all of them at the end of this post.
General Shortcut Keys
Switch between tabs and tool window
This one is very useful since you do not need to switch from your mouse to keyboard to switch between files in your project.
For Windows: Control + Tab
For MAC: Control + Tab
Add to favorites
This is another frequently used general shortcut. Helps you to add a file or class to your favorites, which will, in turn, help you to refer, in some other project or scenario. Check the shortcut key combination below.
Windows/Ubuntu: Alt + Shift + F
Mac: Option + Shift + F
Everyone might already be doing this. The shortcut for this action is,
Inspect Current File with current Profile
If you have the habit of checking your File using lint(Most of the developers don’t, but it is a very good practice to check), you can use the below Key combination.
Windows/Ubuntu: Alt + Shift + I
Mac: Option + Shift + I
This can be useful when you have to quickly replace method/variable name in the given file. Make sure to be careful when doing so.
Windows/Ubuntu: Control + R
Mac: Command + R
Find class is particularly useful in bigger projects with lots of different files. A quick search to go to the Class can save time searching for it in every file.
Windows/Mac: Control + N
Ubuntu: Command + O
Jump to source
Jump to the source has to be the best search shortcut in any ide, it saves a ton of time switching between the implementation and the source. You can find the source of anything using the command shortcut.
Windows/Ubuntu: Control + Enter
Mac: Command + Down Arrow
Open type hierarchy
This is useful to see the type of the method/variable and which class uses it. The shortcut for this is,
Windows/Ubuntu: Control + H
Mac:Control + H
Open method hierarchy
As the name suggests, it shows the hierarchy of methods used in the class. Works only on the methods.
Window/Ubuntu: Control + Shift + H
Mac: Command + Shift + H
Open call hierarchy
This shortcut shows all the places where a specific variable or method is called from. This open call hierarchy can be useful to debug errors easily
Windows/Ubuntu: Control + Alt + H
Mac: Control + Option + H
Go to line
Opens up a dialog to enter the line number to jump to. Helpful in larger files and also reduces time in scrolling.
Windows/Ubuntu: Control + G
Mac: Command + L
Search Every Where
Search everywhere in the project using the command below.
Goes to next search item
Mac: Command + G
Goes to the previous search item
Windows/Ubuntu: Shift + F3
Mac: Command + Shift + G
This is the handiest shortcut in Android studio. It takes care of generating lot of static code for you. Getters, Setters, Constructors, toString methods etc in a press of command. The shortcut for creating that is,
Windows/Ubuntu: Alt + Insert
Mac: Command + N
Basic code completion
Handy when you want to complete a line of code. The general code completion, completes a variable/method names by itself and cannot do anything more. The command for that is,
Windows/Ubuntu: Control + Space
Mac: Control + Space
Smart Code Completion
Smart code completion is useful when you need code completion with respect to the file or class you are working on. A basic code completion does a static job of filling up the rest of the code with what the general implementation can be, check the example below to understand clearly.
Windows/Ubuntu: Control + Shift + Space
Mac: Control + Shift + Space
We will take the same scenario of implementing the Integer above. The class that I am working on has a method called getItemCount() which is in respect to that particular class only. The smart code completion does this,
Surround with (if…else / try…catch / etc.)
Another useful shortcut to create an immediate block around a piece of code, a need for an if/else block or an exception expression which needs a try..catch you can use this shortcut command.
Windows/Ubuntu: Control + Alt + T
Mac: Command + Option + T
Move to code block start
Helps you jump directly to the start of the code block
Windows/Ubuntu: Control + [
Mac: Option + Command + [
Move to code block end
Helps you jump directly to the end of the code block
Windows/Ubuntu: Control + ]
Mac: Option + Command + ]
Select to the code block start
Helps to select to the code block start
Windows/Ubuntu: Control + Shift + [
Mac: Option + Command + Shift + [
Select to the code block end
Helps to select to the end of the code block
Windows/Ubuntu: Control + Shift + ]
Mac: Option + Command + Shift + ]
The single and multi line comments are very helpful when it comes to shortcut codes. I would highly recommend using comments in your coding practice to generate much better readable code. The shortcut for the comment operation is given below.
Comment/uncomment with line comment
Windows/Ubuntu: Control + /
Mac: Command + /
Comment/uncomment with block comment
Windows/Ubuntu: Control + Shift + /
Mac: Command + Shift + /
Build and Run
Windows/Ubuntu: Control + F9
Mac: Command + F9
Build and run
Windows/Ubuntu: Shift + F10
Mac: Control + R
Apply changes – Instant Run
Windows/Ubuntu: Control + F10
Mac: Control + Command + R
Debugging is another important facet of programming, as much you learn to code, you learn to understand what the compiler says in terms of a mistake being created. You can have this shortcuts handy while debugging your program.
Lets you do a debug through an interface. Once you get an error, you can use this option to run the debug application.
Windows/Ubuntu: Shift + F9
Mac: Control + D
Helps you toggle a breakpoint. Breakpoints are artificial stops in the program which can help you know if a program hits it or not (In terms of debugging a broken program with errors)
Windows/Ubuntu: Control + F8
Mac: Command + F8
Helps you view the breakpoints.
Windows/Ubuntu: Control + Shift + F8
Mac: Command + Shift + F8
Smart step into/Step out
Smart step into will help you to jump into a call(In terms of hitting a breakpoint). If there are chained calls, it will ask which method to step into. See the example below.
Windows/Ubuntu: Shift + F7 / Shift + F8
Mac: Shift + F7 / Shift + F8
If you are a using version control/VCS, you can find some useful shortcuts to commit/push your code like.
Commit project to VCS
Windows/Ubuntu: Control + K
Mac: Command + K
Open VCS popup
Opens up the VCS popup like below. A lot of operations can be performed.
Windows/Ubuntu: Alt + ` (backquote)
Mac: Control + V
This is an exhaustive list of all the shortcuts available in Android Studio.
Since you had the patience to scroll till the end. Find the PDF of the list below.
Drop in Any Comments you have in the comment section.
“Learn and Be Curious”