Shortcuts in Android Studio

Android Studio is the ultimate Integrated Development Environment(IDE) for Android Application Development and almost all the developers in the Android world are using Android Studio for their development of apps. It is built on JetBrains’ IntelliJ IDEA software and designed specifically for Android development. For new developers, who want to master Android Development should start with Android Studio than using any other IDE.

Using Android Studio is a little complicated and new users will get used to it over time. But with shortcuts and easy tricks, the process of using the IDE and experience with it becomes easy and more comfortable to use. Here are some shortcuts that will come in hand while using the IDE,

  1. Find a word — Control + F (or) Command + F

This command is used to find an element in the file. The word typed will be highlighted in the entire file which will help you to navigate the word you are looking for the entire file.

2. Find a file — Double Shift

In Mac, Windows and Linux, double shift command will help you to go to the file by just typing the file name or keywords and it will show you all the files having the keyword. This will help you to find the easily instead of traversing the entire project which will save a lot of time.

3. Replace word — Control + R (or) Command + R

Replace command will help you replace a word in the file with some other word. It will help you to replace the particular word occurring in the file with the new word you type saving you a lot of time in changing every word manually.

4. Find a class — Control+N (or) Command+N

While the Double Shift shortcut helps you to find all the files in Android Studio, this particular keyword helps you to find only classes. If you know, you only need to find classes, you can use this command and find the class you want.

5. Find the usage of the word — Control + word (or) Command + word

This command will help you to find the usage of the “word” you want. The word might be a class, variable, method, etc. that you want to find the usage. Hold control or command and click on the word to find it’s usages in the entire project.

6. Go to Logcat — Alt + 6 (or) Option + 6

Logcat, as we all know in an important as it shows important system messages such as when a garbage collection occurs, and messages that you added to your app with the Log class. When an app throws an exception, logcat shows a message followed by the associated stack trace containing links to the line of code. The logcat is available in the bottom of the Android Studio, but when coding for complex apps, we might need to see the logcat often and hence this command will help us traverse and open and close the logcat how much ever times we want.

7. Go to XML Code — Control + B (or) Command + B

This command will come in use when you are in the design view of your XML file and you want to go to the XML code. On using this shortcut will help you go to the code of the current XML file.

8. Format Code — Control + Alt + L (or) Command + Option + L

This is one of the most useful command and it helps you format the entire code in the file if it has any indentation problem. Many languages show error when there is an indentation problem so this is the most useful command.

You can type the line you want and it will lead you to the line. Especially helps when the codebase is long and the file is large.

9. Override Methods — Control + O (or) Command + O

There are many methods to override when it comes to implementing a particular feature or developing an app. This particular command helps you to see all the overridden methods possible in that file or Activity.

10. Surround with loops, exception handlers, runnable methods, etc — Control + Alt + T (or) Command + Option +T

Use this command wherever you want to surround the code with try-catch, if-else, while, do-while or any such loops and it will show you options on what you want to surround with from which you can choose.

I hope you got some useful information from this.

Happy Coding!

Bhavna.