Upgrade to Pro — share decks privately, control downloads, hide ads and more …

How to code like Chuck Norris(Android Studio pro tips)

How to code like Chuck Norris(Android Studio pro tips)

Android Studio pro tips. A lot of useful short key

Volodymyr

May 20, 2016
Tweet

Other Decks in Programming

Transcript

  1. Navigation between files Short desc Shortcut Long desc Recent files

    Ctrl + E As the name says is a list of all recent files that you navigated Quick switcher Ctrl + Tab The same as before but is quicker because you save one keystroke Jump to navigation bar Alt + Home Shows in a popup the top bar and you can navigate between packages/files. Useful when you want to navigate to a file that you already know that is in the same package
  2. Shortcut Short desc Shortcut Long desc Show actions Ctrl +

    ⇧ + A Shows a dialog where you can search actions of the IDE
  3. Editing Short desc Shortcut Long desc Add selection for next

    occurrence Alt + J Imagine that you have 5 lines containing Log.d and you want to change it to Log.e instead of change it manually, select with your cursor “Log.d” press this shortcut and you will see that the column mode is enabled and you will be able to modify that 5 lines at the same time. Surround with Ctrl + Alt + T Surrounds the current line with a block of code like if, try/catch, etc… Enable column mode Alt + ⇧ + Ins When you are in column model you can modify multiple lines at the same time.
  4. Editing Short desc Shortcut Long desc Create a class in

    the current directory Ctrl + Alt + Ins Organize imports Ctrl + Alt + O Removes the unused imports of the current file(OR) Format code Ctrl + Alt + L Reorganizes and formats your current file Generate Alt + Ins Code generation like contructors, getters, setters..
  5. Editing Short desc Shortcut Long desc Move statement up Ctrl

    + ⇧ + Up Moves the current statement up, for ex. if it is a method, it will move above next method Move statement down Ctrl + ⇧ + Down Moves the current statement down, for ex. if it is a method, it will move above next method Shrink selection Ctrl + ⇧ + W Shrinks the selection to line/block/method/class.. Extend selection Ctrl + W Extends the selection to line/block/method/class..
  6. Editing Short desc Shortcut Long desc Duplicate line Ctrl +

    D Duplicates current line and inserts it below Delete current line Ctrl + Y Deletes current line Code completion Tab Completes code with auto replacing
  7. Navigating Short desc Shortcut Long desc Go to next error

    F2 If there is any error, place your cursor in the next one Go to previous error ⇧ + F2 If there is any error, place your cursor in the previous one Jump up hierarchy Ctrl + U Navigate to the super class while inside a file
  8. Navigating Short desc Shortcut Long desc Implementation Ctrl + Alt

    + B Navigate to a child class while inside a file Quick definition Ctrl + ⇧ + I Place the caret in a variable for ex, press the shortcut and you’ll see in a popup the definition Show method parameters Ctrl + P When fulfilling method parameters, press this to see all the parameters needed for this method
  9. Navigating Short desc Shortcut Long desc Hide method implementations Ctrl

    + ⇧ + - Are your method names readable enough? Collapse them and you should be able to understand what is your method doing. I find it pretty useful for testing, the testing method names should be enough to understand what is going on with your test Show method implementations Ctrl + ⇧ + + The same as before but to expand it instead of collapse Method navigation Ctrl + F12 Shows popup menu with all method of a class
  10. Refactoring Short desc Shortcut Long desc Refactor this Ctrl +

    Alt + ⇧ + T Is like the master command, if you forget the others just use this Move F6 Move class from this package, can extract also an Inner class Change signature Ctrl + F6 Changes the signature of a method, class, etc… Extract variable Ctrl + Alt + V Extracts a local variable where you have the cursor, if you can extract various thing it will show a popup to select
  11. Refactoring Short desc Shortcut Long desc Extract method Ctrl +

    Alt + M Extracts a method with the selection Extract field Ctrl + Alt + F Same as extract variable but this time creates a field Extract constant Ctrl + Alt + C Same as extract variable but this time creates a constant
  12. Debugging Short desc Shortcut Long desc Toggle breakpoint Ctrl +

    F8 Enables or disables a breakpoint in the current location Evaluate expression Alt + F8 Evaluate selected expression within new window Next step F8 While debugging if you select next you will advance to next instruction without going inside of the implementation of the current one Continue F9 Continues to the next breakpoint if there is any, if not let the program continue as normal
  13. GIT Short desc Shortcut Long desc VCS Actions Alt +

    ` Shows a popup with the most useful actions for version control Commit Ctrl + K Commits the current changes Push Ctrl + ⇧ + K Variation of the previous one, pushes changes Revert Ctrl + Alt + Z If we are in a git changed line, it will revert only this block, if we are in a changed file it will revert the whole file
  14. Live Templates Short desc Shortcut Long desc Open templates Ctrl

    + J Opens dialog with available templates
  15. Links 1. Keyboard driven development 2. Google I/O 2015 -

    What's New in Android Development Tools 3. Android Studio for Experts (Android Dev Summit 2015)