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
Keymap. You can also hit
SHIFT twice and type
keymap to change the option (I’ll talk more about this later).
Reformat code →
Optimize imports →
Find usages →
Find in path →
The Most Underrated
Let’s continue with something more interesting.
Android Studio (so IntelliJ) has a very smart selection tool. It can be activated pressing
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
UP again until the desired selection is reached. Did you select too much? Don’t worry; pressing
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.
Favorites menu can also be accessed via shortcut by using
To add a class to the favorites, use
To add a class to a new favorites list, use
F, and then
2, and a pop-up will ask for the new list name.
To bookmark a specific line of code, use
F3. There’s no limit to the number of bookmarks that can be added.
F3 will open another view showing all the bookmarks available on the left and the ability to navigate the code on the right.