As an Android developer, I use Android Studio the most, and I’m going to argue that Android Studio is 100 times better than Eclipse. This article is intended to document a relatively new operation in Android Studio, and it may take some time to read. (Don’t you try it while you read it?) I’ll do it in as simple and clear a language as possible. PS: Multi-graph, traffic users should be cautious.

In order to facilitateThe old readersRead. I’ll start with updates.

A new userYou can skip this section, which has been synchronized in the text.

Updated date Update the content note
2016/7/25 Update outline Windows version shortcut key Ctrl+F12 Thanks to Alex_Cin, Bryanno1 for providing and verifying


Activity template

The for loop used to look like this

When iterating over a collection, the object.for generates an iterative loop:

.fori can go like this:

.forR can be reversed:


You can call short like this

Nullity is unavoidable when writing code. Nulls can be like this, object.null:

Non-null can do this for objects.

Stop writing if()

If is the most common one, but I urge you to stop writing if() and try anything that makes sense. If:

Instance can also be cool

Others, such as Switch, hope you explore more

Multi-line editor

Anyone who likes to use editors such as Sublime will be familiar with this.

Multi-line editor

For example, if we have four buttons to define, we can do this first, hold down Alt + left mouse Button and pull down, then we can select multiple rows, and then edit multiple rows at the same time. After editing the same part, we can enter different parts respectively.

Block editor

For example, we want to change the four buttons defined above to TextView:

Again, hold Alt, drag the diagonal, pull out a block, and you can edit the selected block.


This is the Android Studio shortcut. If you still think Alt+Enter is an import package, you’re wrong. You can press it if you need it. It will give operation suggestions according to different situations, greatly improving work efficiency.


I’m going to get the RecyclerView and findViewById in my layout file. I’m going to use the RecyclerView and findViewById in my layout file. (several words omitted here), press enter, and the code is generated.

Create Adapter; Create Adapter; Create Adapter; Create Adapter; Create Adapter; Create Adapter; , enter, and the class is created.

But we need to implement the recyclerView. Adapter method, so we use the shortcut key in the red line, and we see that it gives us a message implement method, Enter, and the method is implemented.

Alt+Enter is the magic key in Android Studio, and it does a lot more than that, so just press it. It’s healthier to press.


Code retrieval is always necessary during code writing. If you are the eyes to find, that efficiency really do not know where to go.

Search basic operations

These search operations ARE what I call basic operations

operation Mac Windows
Search class Command+O Ctrl+N
Search in file Command+F Ctrl+F
Search for files Command+shift+O Ctrl+shift+N
Global search Command+shift+F Ctrl+shift+F

If you’re lazy, these four will basically solve your search problem.

The outline

Mac: Command+F12 Windows: I don’t know… (MY own Mac has some Windows I don’t know. If you don’t have the Fx key on, you can use Command+Fn+F12 as a shortcut key. If you don’t have the Fx key on, you can use Command+Fn+F12 as a shortcut key.

Search Everywhere

As powerful as its name suggests, the shortcut is to double-click Shift and type in the keyword. Even Windows can be searched.


Split screen

You can split it up and down, you can split it left and right, I prefer left and right, sometimes it’s convenient.

You can just use the Search Everywhere function and type split, which gives you two options, vertically and Horizontally, so choose what you want. Or on the TAB in the edit window, right-click and select Split Horizontally or split Horizontally. I prefer Search Everywhere, the keyboard is always faster than the mouse.

The Hierarchy window

The Hierarchy window allows us to see the Hierarchy relationship clearly. We can remember that a good friend will not let you learn Java, and then attached a map of Java inheritance relationship. When the Hierarchy is very deep and complex, the window is not very good.

This is the class inheritance:

Hierarchy (Search Everywhere) or CTRL +H (Windows) can be used to Search Everywhere.

There is also Call Hierarchy, which shows the method invocation Hierarchy:

The shortcut for this is CTRL + Alt +H.


Debugging is an integral part of development.

The snapshot

This feature will save you a lot of work when it comes to UI programming.

During the operation, you can take a screenshot of the phone and save it. No more screenshots from your phone and uploading them to your computer.

Record the screen

When doing the animation function, the screen recording function allows you to better check if the animation is correct.

The breakpoint

The use of breakpoints, breakpoints can be used for more than just stopping the program. Try using Alt+F8 after stopping to bring up the Evaluate Expression screen, which allows you to enter the value you want to view and display it.

Right-click on a breakpoint and you will see the following interface, where you can enter the conditions for stopping a breakpoint at the cursor, which is a magic trick when you need to break a point in a loop:

Before Suspend in the figure above, you see something like this:

There’s a lot more to this screen, so if you check Log Evaluated Expression, and then enter the Log you want to output in the input box below, then the breakpoint won’t stop there, it’ll output a Log in the console.


This post is not over, but if you are reading Android Studio and you have other things to do, please leave a comment. I hope this article has been helpful.