How I use Android Studio - my tips and tricks
Tags: android, productivity, mobile
Published: 2021-12-21 16:48:11

I like to read posts and articles about tricks for Android Studio cause you can learn so many new things. For me, it's fascinating to see how people can optimize working with Android Studio in so many different ways.

Today I want to share 5 tricks I use every day working with Android Studio.

### Tip #1 - I don't use tabs

Without using tabs in Android Studio I feel like I can focus more easily cause I work on one file at a time. When I need to work with two or more files at the same time (e.g. implementation and test files) I simply split the screen.

To disable tabs simply go to `Preferences > Editor > General > Editor Tabs` and
* set `Tab placement` to None
* set `Tab limit` to 1

![Editor tabs settings](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lgk5ip4e21vt8mk2gn3f.png)

How I navigate code without tabs?
* `cmd/ctrl + e` - to look for recently opened file
* `cmd/ctrl + o` - open class
* `cmd/ctrl + f` - open file
* `cmd/ctrl + shift + a` -> `split right` - to split screen when I need to work with two or more files
* `option/alt + tab` - to switch between splitted windows

### Tip #2 - disable design windows

This tip is related to design windows whenever you work with XML or Compose layouts. When you open XML/Compose file Android Studio loads the design window along with the code. It can cause small lag which is annoying especially when you want to quickly skim the code. 

But the good thing is that you can easily disable it. Just go to `Preferences > Editor > Design Tools` and set Code as default editor mode.
![Design tools settings](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wxkrtmfyv3x4amv0ac7z.png)

Now opening XML/Compose file should be faster.

### Tip #3 - studio command

Android Studio allows an easy way to create `studio` command. Simply go to `Tools > Create studio launcher command`. The command allows you to open the specific project directly within Android Studio. It's especially useful when you use the terminal a lot.

Usage example:
```
~$ git clone git@github.com:mrmike/Ok2Curl.git
~$ studio Ok2Curl # opens Ok2Curl with Android Studio
```
or if you are already in the project directory simply call
```
~$ studio .
```

### Tip #4 - find the file in the project structure

I usually work with complex projects with many modules and thousands of files. Often I need to quickly localize the file in the project structure. To do that, I use `option/alt + F1`, and then press 1 for selecting this file in the project structure. 

![Select in window](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ty8xsbts5i3yx91beqdr.png)

After that your file will be selected in the project window.  Additionally you can open file in the finder.

* `option/alt + F1` and then `1` to select file in project view
* `option/alt + F1` and then `8` to select file in the finder
* `cmd/ctrl` + `-` to collapse everything in the project view

### Tip #5 - everything is searchable
In Android Studio (and basically in any JetBrains editor), almost every window is searchable. What does it mean? If you are in the active window you can simply start typing to find the best matching result. Let's look at the example.

Imagine I've just opened recent file window (`cmd/ctrl + e`) and I want to open `README.md`
![Recent files](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/haqiin7cliqpz3pcya3s.png)

I can simply start typing `re` to select file and click enter to open it.
![Recent files - filtered](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/up37nz7n58u4t0r5l002.png)
 
It's a really simple trick but can save you many mouse clicks and the best part is it works almost everywhere :)

### Summary
I hope you'll find tricks useful and maybe you can incorporate some of them into your daily workflow. I'd love to hear from you what're your best tricks in Android Studio. You can leave a comment or ping me on Twitter at [@moczul](https://twitter.com/moczul).