Everyone likes to increase their productivity and everyone has their own favourite productivity hacks, but not everyone agrees! In this blog, Eduard will talk about his top three Android Studio shortcuts and how they're better than the rest.
Before actually jumping into the shortcuts, let me share with you a couple of plugins that will help you and your pairing peer learn more shortcuts, resulting in an increased productivity!
This might be the most used shortcut in IntelliJ / Android Studio (at least by me). It's highly context-aware, giving you a wide range of helpful options, from quick fixes to compilation errors, to improvement suggestions of your code.
I could give you a ton of examples of situations where this shortcut might be used, but I will name just a few of my favorites: adding a final field as a constructor parameter or binding a constructor parameter to a field, flip
Don't be afraid to use it, and try it everywhere, you will be surprised what kind of suggestions it might give you.
Given that you have selected something, it will add the next occurrence to the selection, also adding a cursor there, similar to how Sublime's multiple selection works.
This is particularly useful when you want to apply collectively an operation to similar elements in a group. I mostly use it to alter field's modifiers and to split long lines in situations such as method declarations or calls with many parameters.
If you go too far, you can use "Unselect occurrence" –
⌃⇧G (Mac) |
Alt+Shift+J (Win/Linux) – to step backwards.
Some of my colleagues were mindblown by the power of this shortcut. Basically, it's similar to basic code completion (
⌃Space on Mac,
Ctrl+Space on Win/Linux), but it filters the list of results based on the type of the expected object. This will save you time showing only relevant suggestions, instead of going through an exhaustive list of possibilities.
Even more, if you press the key combination a second time, it will go recursively one level down, giving chained expressions as suggestions. Also, if there is only one possible match, it will complete the statement with it, meaning that it will put the semicolon for you.
Additionally, if you are in a method call, and in that context there are variables matching all the expected types and/or names of the method's parameters, it might give you a suggestion with all the required parameters at once. Pretty neat, isn't it?
Happy and productive programming!
We plan, design, and develop the world’s most desirable Android products. Our team’s expertise helps brands like Sony, Motorola, Tesco, Channel4, BBC, and News Corp build fully customized Android devices or simply make their mobile experiences the best on the market. Since 2008, our full in-house teams work from London, Liverpool, Berlin, Barcelona, and NYC.
Let’s get in contact