Android Studio has a lot of shortcuts to offer. Today, we will be sharing some useful shortcuts which can enhance and boost your productivity. We will be sharing commands for both the Mac and Windows environment. Ready. Get. Set. Go!

Lookup any Action

Android Studio Shortcut Search Actions

Android Studio Shortcut Search Actions

Mac – Cmd + Shift + A
Windows – Control + Shift + A

Using this command you can search for any action you want to do. This command is the mother of all dragons.
Very useful for beginners who are starting to adopt shortcuts and know what Android Studio has in store.

Lookup methods/Code Completion

You can autocomplete method, lookup variables, methods available using the below command.

Mac – Command + Space
Windows – Control + Space

This is a very common command and is available in most IDEs.

Search Everywhere

Press Shift Twice and lookup in your whole project ( Mac and Windows)

Android Studio Shortcut Search Everywhere

Android Studio Shortcut Search Everywhere

Goto File

Search only files –
Mac: Shift + Command + O
Win: Ctrl + Shift + N

Android Studio Shortcut Search By File

Android Studio Shortcut Search By File

To open “class” only use :
Mac: Command + O
Win: Ctrl+N

You can create methods quickly from a selected block of the code as shown below:

Android Studio Shortcut Create Method

Android Studio Shortcut Create Method

Mac – Cmd + Option + M
Windows – Ctrl + Alt + M

To add a single parameter in the method use the following alternative shortcut:

Mac – Cmd + Option + P
Windows – Ctrl + Alt + P

Enclose statement(s)

You can enclose a bunch of code in blocks such as if else etc as shown below:

Android Studio Shortcut Enclose Statements

Android Studio Shortcut Enclose Statements

Mac – Cmd + Option + T
Windows – Ctrl + Alt + T

Delete/Duplicate line

For deleting a line:
mac: Cmd + Backspace
Windows: Ctrl + Y

For duplicating:

mac: Cmd + D
Windows: Ctrl + D

Toggle Case

You can toggle variables and string case easily using the following:

mac: Cmd + Shift + U
Windows: Ctrl + Shift + U

Android Studio Shortcut Toggle Case

Android Studio Shortcut Toggle Case

File Structure

Use Command + 7 or Ctrl + 7 to list the structure (methods and instance variables present in the file):

Clipboard History

Android Studio stores all your copied stuff in clipboard. To access them, use
Mac : Shift + Command + V
Windows : Shift + Ctrl + V

android-studio-shortcut-clipboard-history

 

Android Studio Shortcut Clipboard History

Multiple Selections

This is my personal favourite!
You can make selections for the next occurrence of the keyword as shown below:

Android Studio Shortcut Multiple Selection Cursor

Android Studio Shortcut Multiple Selection Cursor

To do the above just start selecting and dragging down pressing the Alt button.

Alternatively, we can use:

Mac : Ctrl + G
Windows : Alt + J

Goto Next Error

Use the F2 button to goto the next error in your code as shown below:

Android Studio Shortcut Next Error

Android Studio Shortcut Next Error

Reorder Statements

Mac: Shift + Cmd + ↓/↑
Windows: Shift + Ctrl + ↓/↑

Android Studio Shortcut Move Statements

Android Studio Shortcut Move Statements

Auto-generate Code

You can autogenerate code such as getters and setters using the below commands:

Mac: Ctrl + Enter
Windows: Alt+Enter

Android Studio Shortcut Generate Code

Android Studio Shortcut Generate Code

Override methods

You can override methods as shown below:

android-studio-shortcut-override-methods

 

Android Studio Shortcut Override Methods

Mac: Command + O
Windows: Ctrl + O

Change Method Signature

Mac:Cmd + f6
Windows:Control + f6

android-studio-shortcut-refactor-method

 

Android Studio Shortcut Refactor Method

Live Templates

Live Templates can be enabled/disabled from Android Studio preferences.

 

Android Studio Shortcut Live Templates

I’m using Tabs for live templates.
Let’s see what happens when I press tab while creating a Toast.

Android Studio Shortcut Live Templates

Android Studio Shortcut Live Templates

Another important shortcut:
Last Edited location:
Mac:Cmd+Shift+Backspace
Windows:Ctrl+Shift+Backspace

That’s a wrap on this article. Keep exploring shortcuts that boost your speed.

By admin

Leave a Reply

%d bloggers like this: