Android Studio shortcuts and tricks to boost up your productivity!

Mladen Rakonjac
Fleka Developers
Published in
5 min readApr 24, 2017

--

No matter how many shortcuts I use, I always get a feeling that I am not fast enough. Like all other developers, I am trying to use mouse as less as I can. It really puts me out of flow!

,,Can I do it faster ?!’’ is a question that I often ask myself. So, my curiosity helped me to find out a lot of shortcuts that save time. There are some of those that I often use and that I really like:

1. Switching between Activity and related xml file

Using mouse, you can do it this way:

If you have a decent Activity class, you should scroll up to this point and it turns out to be a real nightmare! Mouse?! Seriously!? Let’s find a better solution. We can use Cmd + Shift + O to open R.layout.activity_main xml file :

You have to use one shortcut and you have to type name of that xml file. Often I have activities with similar name and this solution is not that easy.

The shortcut that I like the most is: Cmd + Shift + A and type Related Symbol :

We can do it faster! Let’s make a custom shortcut for Related Symbol, so we can do it in just one shortcut. Let shortcut be Cmd + Shift + X

This way is the best, it is fast, we do not have to use mouse and we do not have to remember the name of a related xml file.

2. Switching between Text and Design for xml file

You can use Ctrl+Shift+Right (Left) to switch between Text and Design:

3. Up with selection and Shrink selection

When I switch to some other IDE or Text Editor, this is the first shortcut that I miss. To do up with selection, use Option + Up and to do shrink selection, use Option + Down:

4. Make new class or interface

I often need to write code related to class that still does not exist. This is how I make this class using Cmd + N:

5. Go to implementation

To go to the implementation of the interface you have to use Cmd + Option+ B :

6. Implement a method that is not implemented yet

To implement a method, go to class name, Option + Enter, go to ,,Implement methods” or go to a place where you want to implement a method and do Ctrl + I :

7. Go to super method

To go to super method you should use Cmd + U (and to go back use Cmd + B) :

8. Override method from super class

To override method from superclass, use Ctrl+O :

9. Add method to superclass

To add current method to superclass, just put @Override annotation, go back to method name, do Option + Enter, go to ,,Pull method to”

10. Change parameters of methods

To change parameters of methods you have to use a Change Signature ( Cmd + F6 ) shortcut:

11. Switch parameters

This one I don’t use that much, but I really like it. To switch arguments you should use Cmd + Option + Shift + Left (Right) :

12. Locate current file

When you have a big project it is really hard to locate current file that you are working on in navigation panel. This button will help you:

If you want it to be done automatically, you have to check Autoscroll from source.

13. Convert local variable to field

To convert local variable to field you should use Field shortcut Cmd + Option + F :

14. Extract layout

You will often have to reuse some part of the layout. For example Loading view. To make your life easier, let’s extract it:

You can use Cmd + Shift + L to extract Layout or Cmd + Shift + L to extract Style.

That’s all! Thank you for reading!

P.S. Thanks to Android Weekly for publishing this article in Issue #257

--

--