Some Android Studio Shortcut


Just moving on from eclipse to android studio – now it’s the official IDE for android and want to give a try.

Some problem I was facing is that I’m too attached with eclipse (sublime text too) so I hate the moment when I need to google some shortcut to make my coding session as efficient as possible.

But overall I love two things that android studio offer :

1. use gradle as default for managing plugin and library

2. the preview layout that lighter than in eclipse

So I decide to move on from eclipse and here some shortcut I’d love to share with you so your zen mode will not disturbed by googling mode for finding shortcut


Opening Class/File/Symbol

Open class 
cmd+o | ctrl+n

Imagine that you must go to a class named “MainActivity”, just use this shortcut and start typing “MainA”.

Open File
cmd+shift+o | ctrl+shift+n

Works like the “Open Class” shortcut but on every files in your project. It is very useful to open your AndroidManifest.xml or anything that sits in the res/ or assets/ folder.

Open Symbol 
cmd+alt+o | alt+shift+n

A very powerful but little less known variation of the previous tips: You can use this to go directly to a method or field by searching its name!

For example, if you know that you have a method named getFormattedDate() somewhere in your project, you can type it in the Open Symbol dialog to go directly to it.

Partial Matching

You can enter incomplete strings and it will work. For example. if you are searching for a class named “ItemDetailFragment”, you can actually type “IDF” and it will find it.

Line Number

Imagine that your colleague just told you that the juicy part is in ExcitingClass at line 23. You can open the file directly by appending a “:” to the class name in the Open Class dialog. e.g.:


You can also combine it with partial matching and type something like:


Recent Files

Recently opened files
cmd+e | ctrl+e

This will show a popup listing the files you navigated to previously.

Recently edited files
cmd+shift+e | ctrl+shift+e

Same as the above but listing only files that have been edited.


Start typing to filter the list.

Navigate Back/Forward 

cmd+alt+left/right | ctrl+alt+left/right

To understand this shortcut, think about how the back and forward buttons work in a web browser. Now, instead of thinking in web pages, think about source code! So when you drill down in code or open a new file, the IDE will remember where you where before, allowing you to quickly go back.

Last Edit Location 

cmd+shift+backspace | ctrl+shift+backspace

This is a variation on the “Navigate Back” shortcut that cycles between the locations where you typed something.

Picture yourself fixing a nasty bug. You think you have the solution so you start fixing it but then realize that you have to look at the android source code and a couple other classes in your project. You enter a function, which leads you to another class, which leads you to another thing and 20 steps later, you finally have the insight needed to complete your fix… but in which file and at what line where you again? Just use this shortcut and you are right back at the exact line where you stopped writing.

Show Usage

In a Persistent Panel
alt+f7 | alt+f7

Shows where something is used. For a class member, it will show where reads and writes are made. For a method, it will show where it is called. For a class, it will show where new instances are created.

You can use the arrow keys and the return key to navigate trough results. You can then press the escape key to go back to the editor.

In Place
cmd+alt+f7 | ctrl+alt+f7

Same as before but shows the information in a popup.

Goto Declaration/Implementation (Drill Down)

Here are three shortcuts to drill down into a symbol:

Goto Declaration

cmd+b | ctrl+b
cmd+click | ctrl+click

Goes to the declaration of the class, method or variable. Mostly useful on classes and methods since it redirects to the implementation.

Goto Implementation

cmd+alt+b | ctrl+alt+b

Shows a list of all the classes/interfaces implementing the selected class/interface. Also works on methods to find where they are implemented/overriden. On variables, it has the same effect as Goto Declaration

Goto Type Declaration 

ctrl+shift+b | ctrl+shift+b

When the caret is on a variable, it will go to the declaration of its type. For example, if I have the following line:

Developer whe = new Developer("whe");

If the caret is on the variable “whe”, this shortcut will go to the declaration of the “Developer” class.

Goto Super

cmd+u ctrl+u

This will open the parent of the current symbol. Pretty much the opposite of Goto Implementation. If the cursor is in an overriden method, it will open its parent implementation. If the caret is in a class but outside the method or on the class name, it will open the parent class.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s