Android Studio Shortcuts and Tricks to Speed Up Your Productivity
In this article; I will talk about some shortcuts that we need while developing app on Android Studio and that speed up our processes by providing a practical flow for mobile developers,.
I actively use many of these shortcuts to make things a little easier and faster, and I see a gorgeous benefit. 👌🏻
There are probably those who know and use some of them. I tried to bring together the most neededs and the bests to benefit everyone. 😊
Auto Fix / Auto Edit / Auto Apply Suggestions :
- Windows : ALT + Enter
- Mac : Option + Enter
Extract Method (Extract the Selected Block as a Separate Method) : 👌🏻
- Windows : CTRL + ALT + M
- Mac : Command + Option + M
Duplicate Current Line or Selection Completely:
- Windows : CTRL + D
- Mac : Command + D
Remove Current Line Completely :
- Windows : CTRL + Y
- Mac : Command + Backspace
Redoing (Move Forward) : ♻️ 🔁
- Windows : CTRL + Shift + Z
- Mac : Command + Shift + Z
When we undo too much while undoing the transactions; You can use it when we need to take a steps forward back to its original state. It is life saver. 👻
Undo as everyone knows CTRL + Z ( Mac : Command + Z)
Enclose Statements ( Include Expressions / Add Statements ) : 🚀
- Windows : CTRL + ALT + T
- Mac : Command + Option + T
It allows to quickly add and enclose the appropriate expression for the cursor location. If-else, try-catch, region or loop etc.
Access to Clipboard History : 🤩
- Windows : Control + Shift + V
- Mac : Command + Shift + V
Accessing the data you copied backwards can be very useful.
Move to start or end of sentence ( Move the Cursor to the Beginning or End of the Line ) :
- Windows : Home / End
- Mac : Command + ← and Command + →
Move to start or end of word ( Move the Cursor at the Beginning or End of the Word ) :
- Windows : CTRL+D
- Mac : Option + ← / Option + →
If you do these movements with Shift, you move by providing a selection.
Move a Line Up or Down :
Windows : CTRL + Shift + ↑ and CTRL + Shift + ↓
Mac : Command + Shift + ↑ and Command +Shift + ↓
Return to the Last Edited Line/Location : 🔙
- Windows : CTRL + Shift + Backspace
- Mac : Command + Shift + Backspace
It returns the cursor to the last edited place.
Delete to Start/End of Word (Delete Word From Beginning / End Of Cursor) :
- Windows : CTRL + Backspace and CTRL + DELETE
- Mac : Option + Backspace & Option + FN + Backspace
Select All Matching Occurrences (Edit All Places Where Selection Is Used) : 👍🏻
- Windows : CTRL + Shift + ALT + J
- Mac : Control + Command + G
- Or by right clicking with the mouse after then Refactor-Rename
Edit Code with Multiple Cursors Sequentially :
- Windows : ALT + J
- Mac : Control + G
Edit Multiple Cursor / Rows : 😎
- Windows : ALT + drag with left mouse click
- Mac : Option + drag with left mouse click
- Or if you drag the lines while clicking on the mouse scroll wheel, you can make multi-editing by making multiple selections.
Comment Out Code : (numped / additional keyboard required)
- Windows : CTRL + /
- Mac : Command + /
Toggle Case (Make Selection Uppercase / Lowercase) :
- Windows : CTRL + Shift + U
- Mac : Command + Shift + U
Go to Declaration directly or by select (Go to Code Usage) :
- Windows : CTRL + Click
- Mac : Command + Click
Reformat Code (Automatic Code Formatting) : 🤌🏻
- Windows : CTRL + ALT + L
- Mac : Command + Option + L
One of the most beautiful shortcuts. This do streamline code by automatic standard indentation of all nested code blocks with nested text.
Add Automatic Override Methods :
- Windows : CTRL + O
- Mac : Control + O
It allows you to automatically implement the methods that the class you are working on can inherit from the classes from which it is overrided or implemented. eg: onCreate, toDestroy, onCreateView, getters/setters and much more.
View Recently used/opened files): 🤝
- Windows : CTRL + E
- Mac : Command + E
We are working on many files during development and need to open them again after closing them, a very practical solution for this situation.
Auto Generate Code : 🤓
- Windows : ALT + INS
- Mac : Command + N
It provides automatic generation of constructure, getter/setter methods, toString — Parcelable implementations and much more standard code in model classes for you.
Search Everywhere : 🥳
- SHIFT + SHIFT ( press Shift twice )
It allows you to make a wide range of searches on the project. It allows you to get Classes, android assets, Gradle files, resources, layouts, colors.xml and much more. Special search support by category appears in tabs.
Find Action :
- Windows : CTRL + Shift + A
- Mac : Command + Shift + A
It’s a handy shortcut when you forget the shortcut to the action you want to do or where to do it. It allows you to access and perform many actions such as Replace, Find, Run, Instant Run.
If you’re using a Macbook, you may need to disable the “Search man Page Index in Terminal” keyboard shortcuts. Or you can reach it with Shift + Shift.
Code Completion : 🧠
- Windows : CTRL + Space
- Mac : Command + Space
It provides easy completion and spelling simplicity by showing the variants that can be used by the written data.
Quick Documentation (See javaDoc — Documentation) : 👊🏻
- Windows : CTRL + Q
- Mac : Control + J
Shows the javadoc documentation of the class or method to be used, if written.
Show List Of Function Parameters :
While the cursor is in the brackets of the method to be used, it allows you to see all the parameters that should be sent to the method.
- Windows : CTRL + P
- Mac : Command + P
Select Opened File — Show Current File on Project Package :🥳
- Windows :
Alt + F1
followed by either1
orenter
- Mac :
Option + F1
followed by either1
orenter
- Or click on related button on project windows top bar
Run :
- Windows : Shift + F10
- Mac : Shift + F10 or Control + R
Debug :
- Windows : Shift + F9
- Mac : Shift + F9 or Control + D
Step Over Debug :
- Windows : F8
- Mac : F8
Evaluate Expressions While Debugging : 🥷🏻
- Windows : ALT + F8
- Mac : Option + F8
You should definitely use the Evaluate expression property to observe the status of variables and objects in your application at debug time. Without making many changes on the code, you can take action on the status of the data at the time of debug.
For example : goobar on youtube
You can find other IDE shortcuts like this from the links in the references.
If you want to customize it for yourself, you can do it on the preferences.
That’s all for now, I hope it will be useful 😊
I add the links where you can find more to below.
REFERENCES :