Android Studio Keyboard Shortcuts : Become a Productive
Android Studio is a most popular and widely used IDE by Android Developers. Research shows that programmers who uses Keyboard Shortcut keys while developing applications are more productive and generates faster output than programmers who uses mouse often for all tasks. Android Studio Keyboard Shortcuts are very well managed.
Using Android Studio Keyboard Shortcuts like autocomplete, code generation, snippets and many more will definitely increase your speed. So first question in your mind might be
Why we should actually know android studio keyboard shortcuts?
It is generally acknowledged by Pro Programmers that you can increase productivity and accomplish more tasks by using the keyboard instead of mouse. In other words, it’s easier and gets your job done faster:). For Example if you want to write getter and setter for all the variables of the class. Than it might be time consuming where android studio provides keyboard shortcut for it.
- Complementarity :
You can take advantage of using keyboard and mouse. Take example like you want to copy some code at the same time you want to also navigate from classes. You can use mouse to navigate between classes and keyboard shortcut for copy and pasting.
Definitely you will become multitasking. If you use android studio keyboard shortcuts you don’t need to check mouse pointer to see what you are doing and you can do that thing semi-automatically thus freeing your mind for other tasks.
Those are the points which i consider as a productive programmer.
As an Android Developer i am going to consider only Android Studio and here i will mention useful
Android Studio Keyboard Shortcuts ( Windows / Mac ):
1. Find path ( Ctrl + Shift + F / Ctrl + Shift + F ) :
This keyboard shortcut is very useful for every developer. Just imagine if you find to find any code or any line from whole project files. By navigating each file and check for required line might be tedious job. In this situation this android studio keyboard shortcuts will be very helpful.
As you can see in the image i want to search for
MovieListHeaderAdapter . Where that adapter used and all other information so in this case i have used Ctrl + Shift + F .
2. Search everything ( Press Shift twice / Press Shift twice ) :
This is a very useful navigational shortcut. It is very simple to use. We can use this android studio keyboard shortcuts when we want to find out Android assests, image resources, layouts, navigate to android gradle file and many more.
You can go anywhere using Double shift press shortcut. Just press shift two times and one popup will appear as you can see in the above image.
I want to find out
drawable_divider_view.xml. So i pressed shift key twice and search for the same.
3. Find class ( Ctrl + N / Command + O ) :
This shortcut is useful when you want to navigate to any particular class. Take a note that you can’t find out any drawables, layouts or assets files using this shortcut.
As you can see in the image i want to search
RecyclerViewGridLayoutActivity class so i have used Ctrl + N android studio keyboard shortcuts.
4. Collapse / expand code blocks ( ( Ctrl + minus /plus ) / ( Command + minus / plus ) ) :
Now just assume that you have a layout file which contains thousands of lines of code. And in that layout file there are lots of hierarchy views and you might want to avoid some part of the code from hierarchy than this shortcut will definitely for you.
As you can see in the first image code is collapsed in a single line and in second line you can see expanded version of code.
For using this android studio keyboard shortcut you need to just go to line of code which you want to collapse and press Ctrl + minus / Command + minus . Same procedure if you want to expand but using Ctrl + plus / Command + plus.
5. Delete entire line ( Shift + Delete / Shift + Delete ) :
If you want to delete entire line of code at that time using Backspace will be time consuming. Instead we can use Shift + Delete. For using this shortcut you need to just go to line which you want to remove and press Shift + Delete.
6. Move line ( Ctrl + Shift + ( Up / Down ) / Command + Shift + ( Up / Down ) ) :
All developers are champion in copy and paste job. But sometimes selecting one line and doing copy and paste job for moving one line to bottom of another line can increase time in development. Instead we can use Ctrl + Shift + (Up / Down) / Command + Shift + ( Up / Down ).
For using this shortcut you need to go on the line which you want to move than just press Ctrl + Shift + (Up / Down) / Command + Shift + ( Up / Down ).
7. Switch between tabs in editor ( Ctrl + Tab / Command +Tab ) :
This is one of my favorite shortcut when i have opened lots of classes in android studio and i want to switch between those classes than this shortcut always best friend of mine.
After pressing Ctrl + Tab / Command +Tab you will able to see one popup as shown in image and than pressing tab key you can navigate to different classes. It is simple to use but very effective.
8. Navigate between open editor tabs ( Alt + ( Right / Left ) Arrow / Control + ( Right / Left ) Arrow ) :
Using this shortcut you can navigate between all open tabs in android studio. Difference between switching shortcut and navigation shortcut is you can navigate between tabs like we are doing in google chrome you can’t directly jump to other tab like we can do it using Switching tab shortcut ( Which we have discussed in No. 6 ).
This tab is most useful for me when i have two tabs open and i want to do some coding stuff in both classes and want to navigate between classes faster.
9. Recently edited files pop-up ( Control + Shift + E / Command + Shift + E ) :
When we are working on so many files some times we want to check files which we have recently updated at that time this shortcut is very useful. As shown in image just press Control + Shift + E / Command + Shift + E. One popup will open from which you can select recently updated files.
10. Reformat code( Control + Shift + E / Command + Shift + E ) :
This is mostly used shortcut. No need to manually indent all the nested if blocks or the for loops. Android Studio takes care of all the formatting. Just Press CTRL+ALT+L on Windows or Command+Option+L on Mac. The android studio will reformat all the code for you.
And the good part is that it works for XML layouts as well. It takes care of ordering of the xml attributes and indenting nested layouts in your code so that you focus more on coding and less on figuring out what is nested under what.
11. Generate code ( Alt + Insert / Command + N ) :
It can be time consuming to type out all the boilerplate code such as getters / setters in model classes, toString implementation, Parcelable Implementation and much more. Android Studio does all this for you. Press ALT+Insert on Windows or Command+N on Mac and android studio will list out all the options that are available such as override methods, implement interfaces, toString implementation etc…
You can see in image Code Generation android studio keyboard shortcut.
So this are the most important and useful shortcut which every productive android developer using everyday. Try your
fingers on it and become productive android developer. Jetbrains constantly improving android studio keyboard shortcuts so take advantages of it.
If you want me to write for you than contact me on twitter on from linkedin.
* You will receive the latest news and updates on your favorite celebrities!
RecyclerView Item Click: Handling single item click and long press (Kotlin)
Today we are going to check about How to handle RecyclerView Item Click?. I am assuming that you already know…
Navigation Drawer Using Navigation View in Android
Navigation Drawer Navigation Drawer is a UI panel that shows your application’s main pages menu items. It opens when…