My Most Used Android Studio Shortcut Keys
Tags: android, beginners
Published: 2022-07-16 00:44:33

**Top 8 Android Studio shortcut keys that I use every day, which I can't live without based on my limited Android development experience**

First of all, I'm not an Android Studio shortcut keys guy because I can't simply remember them. I usually just go to the menu or mouse right-click to look for the tasks that I would like to perform.

However, there are 5 Android Studio shortcut keys that I use every day that I can't live without. This is only based on my 9 months of Android development experience.
 
## 1. Comment/Uncomment (Control + /)

Before I know this shortcut key, I do this

![My_Most_Used_Android_Studio_Shortcut_Keys_01.gif](https://cdn.hashnode.com/res/hashnode/image/upload/v1645527158645/D31suJBd1.gif)

With the **Control + /** shortcut key, I do this

![My_Most_Used_Android_Studio_Shortcut_Keys_02.gif](https://cdn.hashnode.com/res/hashnode/image/upload/v1645527312373/VtEV7UBNE.gif)

> The exact equivalent shortcut key should be **Control + Shift + /**. Because it requires an extra key press, it slows me down. Thus, **Control + /** is good enough for me.

## 2. Go to declaration (Control + B)

Instead of **right click -> Go to -> Declarations or Usages**

![My_Most_Used_Android_Studio_Shortcut_Keys_03.gif](https://cdn.hashnode.com/res/hashnode/image/upload/v1645529128525/SW1zlLY_O.gif)

I just use **Control + B**. 

![My_Most_Used_Android_Studio_Shortcut_Keys_04.gif](https://cdn.hashnode.com/res/hashnode/image/upload/v1645529225154/JIgaXzs7C.gif)

I do this a lot somehow during my development, especially trying to understand the external library API that I'm using.

## 3. Navigate Back / Front (Control + Alt + Left/Right Arrow)

In Visual Studio (while working on C# programming development), I use this little backward and forward icon buttons a lot. Android Studio has these buttons too, but it is not enabled by default.

To enable these back / front navigation icon buttons in Android Studio, click **View -> Appearance -> Toolbar**

![My_Most_Used_Android_Studio_Shortcut_Keys_05.gif](https://cdn.hashnode.com/res/hashnode/image/upload/v1645530135683/AEXMpVlrA.gif)

This shortcut key - **Control + Alt + Left/Right Arrow** is a lot faster instead of clicking the buttons. So I don't turn this toolbar on.

**Control + Alt + Left Arrow** is backward navigation and **Control + Alt + Right Arrow** is forward navigation.

> Somehow, this shortcut key - **Control + Alt + Left/Right Arrow** is not documented anywhere. I can't find it in the official documentation [here](https://developer.android.com/studio/intro/keyboard-shortcuts) too, can you?

## 4. Refactor -> Rename (Shift + F6)
Since I do a lot of **Right Click -> Refactor -> Rename..**, I think it is I should remember this shortcut.

![My_Most_Used_Android_Studio_Shortcut_Keys_06.gif](https://cdn.hashnode.com/res/hashnode/image/upload/v1646277722909/usGBXIySx.gif)

Instead of doing above, I can just select / highlight the class / function name and press **Control + F6**. I do this a lot because I believe having the right name is essential for clean code best practices. 

> I don't like this shortcut key, simply because **F6** is too far away. Generally any shortcut key that consists of function key, I don't like it.


## 5. Show Diff (Control + D)
Another shortcut key that I use a lot is **Control + D** to show diff in GitHub repository. This is my [common practice](https://vtsen.hashnode.dev/how-to-upload-android-studio-project-to-github#heading-step-1-show-diff) to review my code before I commit anything to the GitHub.

![android_studio_share_to_github_13.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1632791558829/u-axyhnk4.png)

The problem is this **Control + D** shortcut key works only when you're in **Commit tab**.  For example, when you're in **Project tab**, it doesn't work anymore. However, you still can **Right Click-> Git -> Show Diff** to view the diff.

> **[Updated: July 17, 2022]** - Added optimize imports shortcut key below.

## 6. Optimize Imports (Control + Alt + O)
There is this **Optimize imports on the fly** setting (File -> Settings -> Editor -> General -> Auto Import) but I do not like it. It removes imports that I need, especially when I'm trying to comment out some code. Thus, I decided to NOT turn it on. 

Thus, I prefer to manually do it. This **Control + Alt + O** comes in very handy. 

![My_Most_Used_Android_Studio_Shortcut_Keys_07.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1658225623196/5AH_ggU6p.png)

> **[Updated: Sept 25, 2022]** - Added search files and classes shortcut key below.

## 7. Search Files and Classes(Press Shift twice)
I discovered this shortcut key recently to search files and classes/symbols in Android Studio. This is especially useful when your project grows larger. I can't find the equivalent menu for this shortcut key. It seems only available for this shortcut key, press Shift twice.

![My_Most_Used_Android_Studio_Shortcut_Keys_08.gif](https://cdn.hashnode.com/res/hashnode/image/upload/v1664098481069/CjqZy7Ta_.gif)

## 8\. Search File Content (Ctrl + Shift + F)

Another useful search functionality, is searching the file content instead of the file itself.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1687251310341/90de4ce7-194a-4797-b3a3-2681c06e20b3.png)

## Conclusion

Well, that's it. I know there are other useful shortcut keys, but honestly I don't use them a lot, except the top 8 shortcut keys above. I will keep this blog post up to date when I find something new. 

---

*Originally published at [https://vtsen.hashnode.dev](https://vtsen.hashnode.dev/my-most-used-android-studio-shortcut-keys)*.