Edit recommendation: Rare earth Nuggets, this is an application for technical developers, you can get the latest and best quality technology nuggets, not only Android knowledge, front-end, back-end as well as products and design dabbler, want to become a friend of full stack engineers do not miss it!

.runtimead{ text-align:center ; background: radial-gradient(ellipse closest-side at center, Rgba (255255255, 1) 70%, rgba (251252253, 1) was 85%, 100% rgba (244247250, 1)); padding: 25px; }

50 Android Studio Tips, Tricks & Resources You should be familiar with, as an Android Developer

This article lists some Android Studio tips and resources that can improve overall productivity.

There are obviously a lot of things, but for the sake of brevity, I’ve limited it to 50. I hope you enjoy it!

Visual effect

1. Android Logcat’s Material color theme.

To change Logcat for Android Studio you need to do this: Go to Preferences (Windows Settings/Linux Machines) → Editor → Colors & Fonts → Android Logcat Then set the foreground color (foreground) for each type of log.

The material color I use:

  • Assert #BA68C8

  • Debug #2196F3

  • Error #F44336

  • Info #4CAF50

  • Verbose #BBBBBB

  • Warning #FF9800

Note that there are several existing themes. You can directly modify the existing theme (not recommended), or click the Save as button to copy a theme and rename it Material Theme Color and change the Color of each type of log.

2. Prevent Logcat from clearing logs when the current application crashes.

From the top right of the Android Monitor panel, click Choose Edit Filter Configuration in the drop-down menu:

Note that it is in the Android Monitor panel at the bottom of the project interface, not in the separate Android Monitor tool.

3. Use an appropriate code theme (IntelliJ/Android Studio).

Go to Preferences → Code Style → Java and select a Code Style (or set a new one) from the Scheme drop-down menu.

Two styles deserve special mention:

  • Square Java Code Styles with Android

  • Google Java Code Style. 

You can import themes as shown in the GIF below:

4. Use split screens for efficiency

To turn on this feature, right-click the TAB on the home screen and select Split Vertically/Horizontally.

But for maximum efficiency we need to set up a custom shortcut. So, go to Preferences → Keymap and search Split Vertically. Then open a context menu and hit Add Keyboard Shortcut.

My vertical shortcut is Set to Control + Alt + V. Do this as shown in the GIF below. You can also set keyboard shortcuts for Horizontal Split.

5. No interference mode

You can enable it in View → Enter Distraction Free Mode

In non-interference mode, the editor takes up the entire IntelliJ IDEA window without any tabs or tools buttons. The code is centered. [IntelliJ Idea Viewing Modes]

6. Use Live Templates

  • You can use the shortcut: CMD + J (Windows/Linux: CTRL + J).

  • You can use Live Templates that are already defined, such as Toasts or if statements.

  • You can use custom templates. Here’s a great reference article by Reto Meier. You can also refer to the documentation for IntelliJ IDEA.

Shortcuts and useful commands

1. The most useful command is the search command: CMD + shift + a (Windows/Linux: CTRL + Shift + A).

Suppose you want to close the current TAB but don’t know how, just type close and you’ll get the correct shortcut/command.

2. Select the latest copy and paste (Admin Clipping edition) : CMD + Shift + V (Windows/Linux: CTRL + Shift + V).

There are five recent copy/paste elements by default.

The depth of the Clipboard stack is configured in the Limits section on the Editor page of the Settings dialog box. When the specified number is exceeded, the oldest entry is removed from the list. [
Cutting, Copying and Pasting in IntelliJ IDEA]

3. Enable the multi-cursor function: Control + G (Alt + J for Windows/Linux).

Bartek Lipinski has a detailed article on this feature on Medium. Highly recommended!

4. Open a class: CMD + O (Windows/Linux: CTRL + N).

Open any file: CMD + Shift + O (Windows/Linux: CTRL + Shift + N).

6. Open symbol: CMD + Option + O (Windows/Linux: Alt + Shift + N).

CMD + Option + b (Windows/Linux: CTRL + Alt + B)

Let’s say you have an interface. Jump to the implementation of the interface by clicking the name of the interface and then pressing the shortcut key. A drop-down selection appears if there are multiple implementations.

8. Go to the definition: CMD + B (Windows/Linux: CTRL + B).

Allows you to quickly jump to where a class, method, or variable is defined.

9. Jump to the type definition: Control + Shift + B (Windows/Linux: CTRL + Shift + B).

Suppose you define:

Employee = new Employee(” Michal “);

When your caret is on Employee, press the shortcut key and you will jump to the Employee class.

10. Go to Super: CMD + U (Windows/Linux: CTRL + U).

For example, if you overwrite some methods, pressing this shortcut will jump you to the parent method when your caret is on the method name.

11. Move between tabs: CMD + Shift + [(Move left) or CMD + Shift +](Move right) (Windows/Linux: Alt + ← / →).

12. Move between Design/Text tabs in layout’s view: Control + Shift + ← / → (Windows/Linux: Alt + Shift + ← / →).

13. Close the current TAB: CMD + W (Windows/Linux: CTRL + Shift + A).

14. Hide all Windows: CMD + Shift + F12 (Windows/Linux: CTRL + Shift + F12).

15. Minimize Android Studio Instance: CMD + M (Windows/Linux: CTRL + M).

16. Format code: CMD + Option + L (Windows/Linux: CTRL + Alt + L)

17. Auto-indent lines: control + option + i (Windows / Linux: 

ctrl + alt + i).

Control + I (Windows/Linux: CTRL + I)

Suppose you want to implement an interface. This shortcut lets you quickly import all the methods of this interface.

19. Smart code completion (filters the list of methods and variables by expected type): control + shift + space (Windows / Linux: ctrl + shift + space).

20. Find: CMD + F (Windows/Linux: CTRL + F)

21. Find and replace: CMD + R (Windows/Linux: CTRL + R).

22. Place a hard-coded string in the resource file: option + Return (Windows/Linux: Alt + Enter). To use this shortcut, the cursor must be above the text. Take a look at the GIF below:

The plug-in

  1. When you click the mouse on a function, I will prompt you what the Key is, and how often do you use this button

  2. String Manipulation – a plugin which provides actions for text manipulation (e.g. toggling styles like camelCase, hyphen-lowercase etc., capitalize text and many more).

  3. Android Material Design Icon Generator – This plugin helps you add Material Design ICONS to your projects. After installation, use the shortcut CMD + Shift + M to generate an icon.

  4. ButterKnifeZelezny – One click to generate the View declaration and ButterKnife annotation for the layout file:



  5. IntelliJ/Android Studio Plugin for Android Parcelable Boilerplate Code Generation – a Plugin that generates Parcelable based on the members of the class.

  6. ADB Idea – a plugin to help you use ADB commands: uninstall, kill, start, restart, clear data, etc.

  7. Genymotion Plugin – A plugin that allows you to create and enable Genymotion virtual devices in Android Studio.

  8. Android Methods Count – a plugin that parses your Android library dependencies and shows the methods count as an handy hint.

  9. Git Flow Integration – a plugin for introducing a Git Flow branching model.

  10. Builder plugin – a plugin (from Square) that generates a static nested Builder for a class.


resources

  1. Android Studio Tips of the Day by Philippe Breault

  2. Shortcut key Reference

  3. (About) 10 Things You (Probably) Didn’t Know You Could do in Android Studio by Reto Meier. 10 Android Studio Tips you May not know

  4. Mouseless development by Hadi Hariri

  5. Android Studio Like a Boss by Philippe Breault

  6. Android Studio for Experts (Android Dev Summit 2015)

  7. Android Studio Tips and Tricks by Michael Evans

  8. Know the Android Studio

  9. Android Studio – Tips and Tricks by Donn Felker

  10. Debug Your App with Android Studio

  11. What are some of your must-have plugins for – Reddit discussion

That’s it for this article, let me know what tips and resources you know.

This article originally appeared on my personal blog.