DEV Community

Michal Moczulski
Michal Moczulski

Posted on

How I use Android Studio - my tips and tricks

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

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

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
Enter fullscreen mode Exit fullscreen mode

or if you are already in the project directory simply call

~$ studio .
Enter fullscreen mode Exit fullscreen mode

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

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

I can simply start typing re to select file and click enter to open it.
Recent files - filtered

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.

Top comments (0)