Android Studio Shortcuts: How to Boost Your Productivity
Using the proper shortcuts when programming and refactoring can not only make a difference in terms of time, but also drastically increase your productivity. IntelliJ IDEA is a great IDE (bye bye Eclipse) and offers a set of shortcuts that help streamline debugging and development operations. Android Studio is the official IDE for Android and is based on IntelliJ IDEA.
The Most Famous
Let’s start with some of the most well-known and regularly used shortcuts for some common operations in Android Studio. I expect every Android developer uses these on a daily basis, so I won’t go into too much detail.
The following shortcuts are set by default on Mac using the keymap option Mac OS X 10.5+
. The keymap option can be changed in Android
→ Preferences
→ Keymap
. You can also hit SHIFT
twice and type keymap
to change the option (I’ll talk more about this later).
Reformat code → CMD
+ ALT
+ L
Optimize imports → CTRL
+ ALT
+ O
Rename → SHIFT
+ F6
Find usages → ALT
+ F7
Find in path → CMD
+ SHIFT
+ F
Run → CTRL
+ R
The Most Underrated
Let’s continue with something more interesting.
Selection Tool
Android Studio (so IntelliJ) has a very smart selection tool. It can be activated pressing ALT
+ UP
, and the selection tool will automatically select the whole statement/expression/line you’re looking at.
If the selection needs to be expanded, just press ALT
+ UP
again until the desired selection is reached. Did you select too much? Don’t worry; pressing ALT
+ DOWN
will revert the selection tool to the previous state.
Bookmarks and Favorites
For large projects, bookmarks and favorites are a lifesaver, as they offer the ability to mark specific classes or specific lines of code and easily access them later.
By default, bookmarks and favorites are located in the favorites menu in the tool buttons on the left.
The Favorites
menu can also be accessed via shortcut by using CMD
+ 2
.
Favorites
To add a class to the favorites, use ALT
+ SHIFT
+ F
.
To add a class to a new favorites list, use ALT
+ SHIFT
+ F
, and then 2
, and a pop-up will ask for the new list name.
Bookmarks
To bookmark a specific line of code, use F3
. There’s no limit to the number of bookmarks that can be added.
Using CMD
+ F3
will open another view showing all the bookmarks available on the left and the ability to navigate the code on the right.