Android Studio Shortcuts

Mohammad Shaddad,

I have been doing a lot of Android development lately, and I've been getting to learn a few shortcuts and commands that are increasingly making my life easier. In the spirit of giving back, I'm writing this list of the most handy shortcuts in Android Studio.

1. Search for command: who doesn't need this? I can't remember all commands or how to get to them, so I use cmd + shift + a on Mac or ctrl + shift + a on Windows/Linux.

2. Choose content to paste: another gem! This command allows you to select to paste from your clipboard history. By default, this will show you the last 5 entries in your clipboard. The shortcut for this command is cmd + shift + v on Mac or ctrl + shift + v on Windows/Linux.

3. Move between tabs: this command will allow you to navigate between open tabs. To move left, press cmd + shift + [ on Mac or alt + ← on Windows/Linux. To move right, press cmd + shift + ] on Mac or alt + → on Windows/Linux.

4. Close current tab: to close the current tab, press cmd + w on Mac or ctrl + F4 on Windows/Linux.

5. Go to implementation: this command will show you the classes that implement an interface. To use this command, select and interface name and then cmd + option + b on Mac or ctrl + alt + b on Windows/Linux.

6. Go to declaration: this command will take you to the declaration of a class, method or variable. To use this command, select the desired bit, and cmd + b on Mac or ctrl + b on Windows/Linux.

7. Go to type declaration: this command will take you to the declaration of the type of a specific variable. For example, assume you have the following variable declaration:

Article article = new Article(); 

If you select the variable article and then use cmd + shift + b on Mac or ctrl + shift + b on Windows/Linux you will be taken to the declaration of the Article class.

8. Go to super: this command will take you to the super method implementation of the method you have selected. To use this command, press cmd + u on Mac or ctrl + u on Windows/Linux.

9. Implement methods: to auto generate skeleton implementations of an interface you plan to implement on a class, select the interface name in your declaration the then press control + i on Mac or ctrl + i on Windows/Linux.

10. Format your code: even though I try to keep my code formatted and well indented, sometimes I fall behind! To auto format your code, press cmd + option + l on Mac or ctrl + alt + l on Windows/Linux.

11. Auto-indent lines: this goes hand in hand with the previous one for me! Press control + option + i on Mac or ctrl + alt + i on Windows/Linux to add/remove tabs/spaces (which one are you? :)) to/from lines.

12. Smart code completion: when you are trying to figure out the full name, press control + shift + space on Mac or ctrl + shift + space on Windows/Linux for a filtered suggested list of variables or methods.

13. Move hard coded strings to resources: always define your strings in resources first! But if you happen to drop one every once in a while, then you can quickly move it to a resource file by pressing option + return on Mac or alt + enter on Windows/Linux.

14. Go to last edit location: this one was sent in by @greekcode on twitter. Use cmd + shift + backspace on Mac or ctrl + shift + backspace on Windows/Linux to go back to last edit location; across files!

This is a summary list of the most useful commands. Of course, there are plenty more like the famous find or replace commands, but to keep it short here, I have decided to stop at 13 of my most loved shortcuts. You can find a complete list of Android Studio shortcuts here.

Do you think there are more worthy shortcuts/commands to make the list? Leave them in the feedback section below. I'll also be updating this page as I stumble upon more of them.

Updated on Jan 11th to add shortcut #14


What level is this content for?

We've all had our humble beginnings, it's our hard learned experiences that got us to master our code. We will all learn something sharing our knowledge, leave a legacy and write a post now.
create Write post

About the author

Mohammad Shaddad
Mohammad Shaddad

Mohammad is a technology consultant and entrepreneur with big passion for technology and living systems; aka software communities. He enjoys mentoring other programmers and entrepreneurs, as well as creating new things. Mohammad is the founder of @barmijly and @nafaqati. He currently spends his time between Amman.JO and Dubai.AE.