Android Studio Shortcuts to Boost Development Efficiency

Android Studio Shortcuts to Boost Development Efficiency

/ Today’s Tech News /

Recently, foreign media reported that Tesla is considering reducing the price of the China-made Model 3 by 20% or more next year to attract more consumers. However, the Tesla China team quickly responded, stating that they had not heard of this matter and urged consumers to refer to the official website for information.

/ Author’s Profile /

This article is reprinted fromHiDhl‘s blog, which organizes commonly used shortcuts in Android Studio, and I believe it will be helpful to everyone!

Original article link:

https://juejin.im/post/5df4933e518825126e639d62

/ Introduction /

A good idea can improve our work efficiency. If we master some shortcuts, it can help us free ourselves from tedious repetitive tasks, and the efficiency of coding will increase. Next, I want to share some practical shortcuts.

/ Main Content /

Parameter Hint

If a method’s parameters are super long and you don’t know what they are, we can use the shortcut below.

  • Mac: Cmd + P

  • Win/Linux: Ctrl + P

Android Studio Shortcuts to Boost Development Efficiency

Auto Extract Method

When optimizing code, we often see long and messy code. Our traditional approach is to create a new function and copy the code over. This process can be completed using the shortcut below.

  • Mac: Cmd + Alt + M

  • Win/Linux: Ctrl + Alt + M

Android Studio Shortcuts to Boost Development Efficiency

Auto Extract Parameter

During development, it is better to pass the variables used by the function as parameters. If you modify them manually, it can be tedious to change them everywhere. The shortcut below can free you from this.

Mac: Cmd + Alt + P

Win/Linux: Ctrl + Alt + P

Android Studio Shortcuts to Boost Development Efficiency

Of course, if you just want to overload the method, check the box in the pop-up dialog.

Android Studio Shortcuts to Boost Development Efficiency

Auto Generate Variable

  • Mac: Cmd + Alt + V

  • Win/Linux: Ctrl + Alt + V

Android Studio Shortcuts to Boost Development Efficiency

Search Method Call

When refactoring, optimizing, or reading someone else’s code, if you want to know who called a certain method, you can use the command below.

Mac/Win/Linux: Alt + F7

Android Studio Shortcuts to Boost Development Efficiency

Refactoring Shortcuts

During refactoring, many operations can be completed using shortcuts, but there are too many refactoring shortcuts to remember them all. There is one shortcut that can help us.

  • Mac : Ctrl + T

  • Win/Linux: Ctrl + Alt + Shift + T

Android Studio Shortcuts to Boost Development Efficiency

Wrap Code

  • Mac: Cmd + Alt + T

  • Win/Linux: Ctrl + Alt + T

Android Studio Shortcuts to Boost Development Efficiency

Batch Rename

If during development or optimization, you find that variable names are poorly chosen or misspelled, and you need to modify all variables used, the shortcut below can free your hands.

Mac/Win/Linux: shift + F6

Android Studio Shortcuts to Boost Development Efficiency

View Method Call Hierarchy

Sometimes when reading code, you want to know the call structure of a method. The shortcut below will help you.

  • Mac: Control + Option + H

  • Win/Linux: Ctrl + Alt + H

Android Studio Shortcuts to Boost Development Efficiency

View Class Hierarchy

When reading source code, if you want to know the call structure of a class, you can use the shortcut below.

  • Mac: Control + H

  • Win/Linux: Ctrl + H

Android Studio Shortcuts to Boost Development Efficiency

Error Shortcut Hint

When writing code, you may encounter warnings given by the IDE. The shortcut below can help you effectively resolve warnings.

Mac/Win/Linux: Alt + Enter

Android Studio Shortcuts to Boost Development Efficiency

Show All Methods of Current Class

When we are reading someone else’s code or source code, and we want to see what methods, constants, and variables the current class has, the shortcut below will give you a big picture, which is very practical.

  • MAC: Cmd + Fn + F12

  • MAC External Mechanical Keyboard: Cmd + F12

  • Win/Linux: Ctrl + F12

Android Studio Shortcuts to Boost Development Efficiency

Highlight

When we need to see where a variable is called, this shortcut will highlight all places where this variable is used.

  • Mac: Cmd + Shift + Fn + F7

  • MAC External Mechanical Keyboard: Cmd + Shift + F7

  • Win/Linux: Ctrl + Shift + F7

Android Studio Shortcuts to Boost Development Efficiency

Quick Jump to Parent Class

When we are reading code and want to jump to the parent class, the usual approach is to go back to the beginning of the class and click in. If the code is long, this is inefficient. The shortcut below can help you quickly jump to the parent class.

  • Mac: Cmd + U

  • Win/Linux: Ctrl + U

Android Studio Shortcuts to Boost Development Efficiency

Quick Jump to Implementation

When an interface has multiple implementations, when we click on a method of the interface, we want to see its different implementations in subclasses. This shortcut can help you quickly jump to the implementation in subclasses.

  • Mac: Cmd + Option + B

  • Win/Linux: Ctrl + Alt + B

Android Studio Shortcuts to Boost Development Efficiency

Override or Implement Method

This shortcut is simple; it pops up a box for you to choose which method to override or implement.

  • Mac: Control + O

  • Win/Linux: Ctrl + O

Android Studio Shortcuts to Boost Development Efficiency

Generate Default Methods

If we want to quickly generate default methods for a class, such as constructors, toString(), Setter(), Getter(), etc., we can use the shortcut below.

  • Mac: Cmd + N

  • Win/Linux: Alt+Insert

Android Studio Shortcuts to Boost Development Efficiency

/ Summary /

For easy viewing, a summary of the above shortcuts is provided.

Description

Shortcut

Parameter Hint

Mac: Cmd + P Win/Linux: Ctrl + P

Auto Extract Method

Mac: Cmd + Alt + M Win/Linux: Ctrl + Alt + M

Auto Extract Parameter

Mac: Cmd + Alt + P Win/Linux: Ctrl + Alt + P

Auto Generate Variable

Mac: Cmd + Alt + V Win/Linux: Ctrl + Alt + V

Search Method Call

Mac/Win/Linux: Alt + F7

Refactoring Shortcuts

Mac : Ctrl + T Win/Linux: Ctrl + Alt + Shift + T

Wrap Code

Mac: Cmd + Alt + T Win/Linux: Ctrl + Alt + T

Batch Rename

Mac/Win/Linux: shift + F6

View Method Call Hierarchy

Mac: Control + Option + H Win/Linux: Ctrl + Alt + H

View Class Hierarchy

Mac: Control + H Win/Linux: Ctrl + H

Error Shortcut Hint

Mac/Win/Linux:Alt + Enter

Show All Methods of Current Class

MAC: Cmd + F12 Win/Linux: Ctrl + F12

Highlight

Mac: Cmd + Shift + Fn + F7

Win/Linux: Ctrl + Shift + F7

Quick Jump to Parent Class

Mac: Cmd + U Win/Linux: Ctrl + U

Quick Jump to Implementation

Mac: Cmd + Option + B Win/Linux: Ctrl + Alt + B

Override or Implement Method

Mac: Control + O Win/Linux: Ctrl + O

Generate Default Methods

Mac: Cmd + N Win/Linux: Alt+Insert

Recommended Reading:

After reading this article, use Jetpack’s ViewModel with your eyes closed.

The author said this is the interview experience of a junior Android engineer? It scared me!

I wrote an Android email framework in my freshman year.

Welcome to follow my WeChat official account

for learning technology or submitting articles.

Android Studio Shortcuts to Boost Development Efficiency

Android Studio Shortcuts to Boost Development Efficiency

Long press the image above to scan the QR code to follow.

Leave a Comment