Click here to Skip to main content
15,885,084 members
Articles / Mobile Apps
Tip/Trick

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

Rate me:
Please Sign up or sign in to vote.
5.00/5 (6 votes)
21 May 2014CPOL3 min read 14.2K   8  
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)


Written By
Founder Across Time & Space
United States United States
I am in the process of morphing from a software developer into a portrayer of Mark Twain. My monologue (or one-man play, entitled "The Adventures of Mark Twain: As Told By Himself" and set in 1896) features Twain giving an overview of his life up till then. The performance includes the relating of interesting experiences and humorous anecdotes from Twain's boyhood and youth, his time as a riverboat pilot, his wild and woolly adventures in the Territory of Nevada and California, and experiences as a writer and world traveler, including recollections of meetings with many of the famous and powerful of the 19th century - royalty, business magnates, fellow authors, as well as intimate glimpses into his home life (his parents, siblings, wife, and children).

Peripatetic and picaresque, I have lived in eight states; specifically, besides my native California (where I was born and where I now again reside) in chronological order: New York, Montana, Alaska, Oklahoma, Wisconsin, Idaho, and Missouri.

I am also a writer of both fiction (for which I use a nom de plume, "Blackbird Crow Raven", as a nod to my Native American heritage - I am "½ Cowboy, ½ Indian") and nonfiction, including a two-volume social and cultural history of the U.S. which covers important events from 1620-2006: http://www.lulu.com/spotlight/blackbirdcraven

Comments and Discussions

 
-- There are no messages in this forum --