Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Mobile

A Collection of the Most Useful Droidio (Android Studio) Hotkeys

5.00/5 (6 votes)
21 May 2014CPOL3 min read 14.5K  
A potentially-exhausting-but-not-exhaustive list of shortcut key combinations to use in Android Studio

Getting Tipsy

The following list has been gleaned from the "Tip of the Day" that you will see whenever you start up Droidio (unless you deselect the "Show Tips on Startup" checkbox). An example Tip looks like this:

Image 1

List of Some of the Most Useful Hotkeys, &c

  • Bring up list of valid parameters => Ctrl+P
  • Move to last place edited => Ctrl+Shift+Backspace (keep going for all changes in current editing session)
  • Highlight usages of a variable in the current file => Ctrl+Shift+F7; then F3/Shift+F3 to navigate forward/backward; Escape to remove the highlighting
  • Reformat code => Ctrl+Alt+L
  • Remove unused imports => Ctrl+Alt+O
  • See previous code changes made => Right-click > Local History... > Show History. This is one of my favorite Droidio features, and I wrote about it here.
  • See declaration of current method => Alt+Q (but if you can't see it by casting a glance upward, it's probably too long)
  • View Recent Files => Ctrl+E, then select it (single click) to open it front-and-center
  • Navigate to highlighted syntax errors => F2/Shift+F2
  • Navigate to compiler err msgs or search results => Ctrl+Alt+Up/Ctrl+Alt+Down
  • Code Completion => Ctrl+Space
  • Code Templates => Enter the first part of what you want, then hit Ctrl+J. For example, if you enter "it" and then Ctrl+J, and then select "itco iterate elements of java.util.collection" from the list, it will provide you with the following code:
    Java
    for (Iterator iterator = collection.iterator(); iterator.hasNext(); ) {
        Object next =  iterator.next();
    
    }
    
  • Move between methods => Alt+Up/Alt+Down
  • Clipboard Chain Usage => Ctrl+Shift+V
  • See the inheritance hierarchy of a selected class => Ctrl+H; for example, if you highlight "AsyncTask" and select Ctrl+H, you might (depending on the contents of your project) see something like: Image 2
  • Go to declaration => Ctrl+B
  • Universal search for method or field => Ctrl+Alt+Shift+N
  • Complete a programming statement => Ctrl+Shift+Enter; for example, if you enter "if" and then Ctrl+Shift+Enter, you'll get:
    Java
    if () {
    }
    
  • Get definition of the current symbol => Ctrl+Shift+I
  • See changes made to files => Alt+9; right-click for version control actions and to see diffs
  • Show project-wide usages of a class, method or variable => Ctrl+Alt+F7
  • Locate menu, command, or toolbar action => Ctrl+Shift+A, start typing its name
  • Find a setting => Ctrl+Alt+S, enter in edit box
  • View all Exit points of a method => Place the cursor at one of them, then Ctrl+Shift+F7
  • View all statements within a method where certain exceptions can be caught => Place the caret at the "throws" keyword, then Ctrl+Shift+F7
  • Quick Fix => Alt+Enter
  • Navigate to any part of a file path of an open file => Ctrl+Click the file's tab
  • Create Test => Select class name, Alt+Enter > Create Test...
  • Select columns of text / vertical text => Hold Alt while dragging
  • Quickly switch between files => Ctrl+Tab
  • See list of items marked with "TODO" => Click rectangle in SW corner, select "TODO" from the list
  • See appropriate refactoring options => Highlight the symbol and press Ctrl+Alt+Shift+T
  • Search everywhere => 2-press Shift
  • Navigate to members of current file => Ctrl+F12
  • Override methods of the base class => Ctrl+O
  • Automatically generate code => Alt+Insert
  • Add code to catch exceptions thrown by a code fragment => Select the code, then press Ctrl+Alt+T, and select "Surround With > try/catch"
  • Simplify code => Select Ctrl+Alt+V. For example, doing so in this code:
    Java
    Toast.makeText(MainActivity.this, "Gooseberry Pie is not just for Geese anymore", Toast.LENGTH_SHORT).show();
    ...and then selecting the string gives you:
    Java
    String text = "Gooseberry Pie is not just for Geese anymore";
    Toast.makeText(MainActivity.this, text, Toast.LENGTH_SHORT).show();
    
  • Comment/Uncomment lines or blocks of code => Ctrl+Slash/Ctrl+Shift+Slash
  • Get help for the current item => Shift+F1
  • Insert the appropriate cast type => Ctrl+Shift+Space
  • Code block completion => enter an abbreviated bit of code, then mash the Tab key. For example, enter "itar" and then press Tab. You will get:
    Java
    for (int i = 0; i < FOCUSED_STATE_SET.length; i++) {
        int i1 = FOCUSED_STATE_SET[i];
    }
    
  • Get a fuller description for a menu item => Hover over it, and look at the left edge of the status bar at the bottom

Stick a Fork in It

As an exercise left for the reader, you could "fork" this list of tips (or, "Add your own alternative version" as CodeProject so pithily puts it) and organize them into particular categories, if that "floats your boat" or is necessary in order to meet your tough standards.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)