As developers we are very lazy persons and want to type less and even do less clicks whenever it’s possible. That’s why we use shortcuts. If you work with Android Studio for some period of time I guess you already know about the most popular ones (like Ctrl+E , Cmd/Ctrl + Shift + A , Cmd + O / Ctrl + N , etc.)

No mouse at work! Only keyboard, only hardcode!

However there are some shortcuts and tips to work with them that are very helpful but not easy to find. That’s why I decided to share some of them with you.

1. Go to a next highlighted error in the file — F2

Let’s start with a normal and very useful shortcut that a lot of android developers don’t know though F2 . Pressing the F2 button will navigate you to the next error, that's highlighted by the IDE in the current opened file (or to the warning if there's no errors). I use it all the time when refactoring code.

2. Find class constructor calls — Ctrl + B (near parenthesis)

One of the most popular shortcut used by developers is “Find declarations” ( Ctrl + B or Ctrl + Click ) that can show you all the places where the class, method or a field are used in the code. One popular action I notice myself doing during the code reading is searching a class constructor calls.

There’s a small trick with which you can do it using the Ctrl + B shortcut: just put the carret between the class name and the first constructor parenthesis (or after the parenthesis, before the first constructor param), and then click Ctrl + B . Then Android Studio will show you only constructor calls of the class. You can achieve the same behavior selecting the class name and pressing Ctrl + B

3. Use only first letters of class name words to find the class

There is quite a big amount of options to navigate to the class if you know it’s name ( Shift + Shift , Cmd + O / Ctrl + N , etc.). You can save your time typing the whole class name in all of this search operations if you only type first letters of the class.

For example lets imagine we want to find a class NeatFeatureViewModel. If you name all other classes within this feature with the same prefix, than you will only find your class in the search results after typing NeatFeatureViewM. It’s a lot easier and faster to type only the first capital letters (or 2/3 of them, if there are a lot of classes in the project) to find the class you want. For example if we type just NFVM we can narrow down our search results to the classes with the same abbreviation. If you still see a lot of results, just type NeatFVM.

As I was pointed out in the comments, you can go even deeper and use chunks of the class name, as long as they’re in order. In our example, typing NVM would get us to NeatFeatureViewModel in even fewer keystrokes.

4. ADB Idea — Ctrl + Shift + A

Well it’s not a normal hotkey actually, it comes from the ADB Idea plugin. It can let you do some of the most regular tasks with adb (like restarting app, cleaning data or uninstalling) very easy within seconds.

5. Assign a shortcut to any of your gradle task.

Depending on the type of project you have you may want to start the same gradle task periodically every day. That’s where you can save your time and assign a shortcut to this task. To add it go to Keymap menu in Android Studio preferences. Then open External Build Sistems -> Gradle -> Choose a task to assign a shortcut.

6. Toggle offline mode.

You can benefit a lot from working in offline mode. It saves your time reusing dependencies from cache and not resolving them from the network. But sometimes you need to turn offline mode off, to sync/update a library, that’s where it would be handy to switch offline/online modes by a shortcut.

Well, actually that shortcut is not working right now, though it’s available in the Android Studio shortcut keymap. I’ve found some issues on the google issue tracker connected with it 1, 2. If you also want to have that shortcut check that issues and star them, maybe it would help. Right now we should only use mouse to turn it on or off.

7. Press TAB instead of ENTER if you want to change the method name

Do you regularly face the situations, when you just want to change the method name (saving the arguments) a bit, you put your cursor on the middle of the name, IDE helps you to choose the method you wanted, then you press the ENTER but to but the part of the method name after the cursor is not removed and you should remove it by yourself? I do and I hate them. But recently I've found a simple trick to deal with this problem.

Lets say we have the following code:

calculateCatsNumber(container)

And you want to change the method to a calculateDogsNumber method call. Then just put the cursor on the end of the calculate word, type D but when the Android Studio shows you the methods to choose from don't press ENTER but TAB instead. It will do exactly what you need only changing the method name.

Same operation you can do with variables, class names and even xml attributes.

8. Add your own shortcuts.

The shortcuts that would help you depend on the type of your project and you can find a lot of shortcuts useful if you just check in the Preferences -> Keymap menu in the IDE. Take a look at how often you make any repeating task in IDE with a mouse and there is a big chance that you can make this operation a lot faster with shortcuts. You can also try a KeyPromoter plugin that will show you the shortcut to replace the action you do with mouse clicks.

9. Share your favorite shortcut in the comments section.

I’d be happy if you can share some of your own favorite shortcuts in the comments section below, because I believe every experienced developer have some shortcut or a tip that others may not know about.

Usefull links (all clickable):