10 Most Useful Android Studio Shortcuts

When doing development using Android Studio, the most common actions performed by developers are updating code, switching tabs, changing source editors and opening files. Therefore, able to perform all these navigation within Android Studio with a simple editor or storyboard shortcut will definitely give your productivity a significant boost!

In this article, let’s look at the top 10 most useful Android Studio shortcuts for navigation that every developer should know.

In this article, let’s look at the top 10 most useful Android Studio shortcuts for navigation that every developer should know.

1: Search Anywhere:

Shift + Shift

Just press SHIFT twice anywhere, and you will be able to search anything in the complete source code.

This is the holy grail of the navigational shortcuts. It’s really simple. Search Android assets, navigate to the Gradle files, image resources, layouts, colors.xml and much more. There is nowhere you can’t go with the Double Shift shortcut.

2: Recently Opened Files:

Command + E / CTRL + E

Just press Command + E or CTRL + E (If you are on windows) to see recently opened files.

More often than not, you’ll not be working with all the project files at once. You would be working on a specific module in a project and will be playing around some specific files of that module. The Android Studio has an option where you can browse the most recently opened files on the go.

3: Generate Code:

Command + N / ALT + INSERT

Hold Command and press N or Hold ALT and press INSERT key(If you are on windows) to generate any code, constructors etc.

It can be time consuming to type out all the boilerplate code such as getters/setters in model classes, toString implementation, Parcelable Implementation and much more. Android Studio does all this for you.

4: Override Methods:

Control + O / CTRL + O

Hold Control and press O or CTRL and press O(If you are on windows) to override any method.

When extending a Fragment or Activity class, you need to override certain methods such as onCreate and onCreateView. Apart from that you can also override lifecycle methods such as onPause, onResume, onDestroy. Android studio generates all this boilerplate code for you.

You can see there are hundreds of methods which can be overridden and it is not possible to remember them all. So this shortcut comes in handy during development phase. You can also start typing a part of the name of method you want to override and the list will filter automagically.

5: Delete Whole Line:

COMMAND + DELETE / CTRL + Y

Hold Command and Press Y or CTRL + Y(If you are on windows) to delete the whole line.

If you want to delete the entire line, no need to select using a mouse or pressing backspace for the whole day.

6: Collapse and Expand Code Blocks:

Command + + / CTRL + +

To Expand and Collapse a code block, hold Command and press + or Hold CTRL and press + in order to expand and collapse a code block.

Every developer is familiar with the callback hell, OnClickListeners, Dialog Click Listeners etc… These are anonymous classes that have multitudes of methods that need to be overridden. If you have a large codebase, then looking at such code can be daunting. Android Studio provides this option of collapsing and expanding all the blocks of code, just showing the method names so that you can find the method you are looking for easily, or just close out all other distractions and make your IDE look neat!!

7: Reformate Code

Command + Options + L / CTRL + ALT + L

In order to formate a code, select the code that you want to reformate and Hold down COMMAND and OPTION and press L or CTRL and ALT and press L.

Again this is one of the most important shortcut that you can use. No need to manually indent all the nested if blocks or the for loops. Android Studio takes care of all the formatting.

And the good part is that it works for XML layouts as well. It takes care of ordering of the xml attributes and indenting nested layouts in your code so that you focus more on coding and less on figuring out what is nested under what.

8: Go to declaration

Command + B / CTRL + B

In order to go to the file declaration or origin, just put the cursor on that instance, and Hold Command And press B or Hold CTRL and press B(If you are on windows) to go to it’s declaration or origin.

Mostly, I use this when I want to change the data type of the declared variable or modify the structure of the class.

9: Shifting Between Tabs

CTRL + TAB

In order to move between opened tabs, just Hold down CTRL and Press TAB to go to any opened tab.

Use this shortcut to navigate between the open tabs in Android Studio. Just remember me and this shortcut when you feel lost among the sea of tabs open in front of you. (This shortcut is same for all platforms).

10: Build and Run

CTRL + R / Shift + F10

In order to build and run a project , just hold down CTRL and press R or hold SHIFT and press F10(If you are on windows) to build and run a project.

Use this shortcut to build your project and run it on the device or emulator.

WRAPPING UP!!

To be able to use all these shortcuts proficiently might seem a bit overwhelming at first. However, once you started using them on your day-to-day development work, you should be able to master them in no time.

Just remember, practice makes perfect. 👍

I hope this article gives you a very good idea on how you can improve your productivity by using these 10 amazing shortcuts. Feel free to post any new shortcuts that I’ve missed. Of course there are so many that I just can’t wrap them all in a single article.

--

--

--

Mobile App Developer | Technology Enthusiastic

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

EYWA referral program.

How to connect 2 VCN’s in different Regions using Remote Peering Connection

Launch AWS ec2 instance using Ansible:

Golang: Event-driven architecture

Caesar Cipher: A Simple Encryption System in PicoLisp

So Apparently There’s An ++i Function

An abacus

Solving Leetcode 807. Max Increase to Keep City Skyline (medium)

The launch of the new Relay Network.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ali Raza

Ali Raza

Mobile App Developer | Technology Enthusiastic

More from Medium

Best Android App Development Tools & Software

Day92 of #100DaysOfCode

Programmers — 9 useful lessons you need to learn from gym

Difference between activity and fragment android