Four handy Android Studio shortcuts for Eclipse users

android-studiologo.png
android-studiologo.png

 Image: Google

Most Android developers have or are in the process of making the jump from Eclipse to Android Studio. As a long-time user of Eclipse, I think Google's decision to move its tools away from Eclipse to IntelliJ was a smart one. The IntelliJ environment coupled with Gradle brings Android developers a modern IDE that rivals Microsoft's Visual Studio and Apple's Xcode.

Unfortunately, for those of us who have become accustomed to Eclipse, warts and all, knowing Android Studio is a better development environment doesn't do anything to alleviate the short-term frustration of looking for all those shortcuts we take for granted. Let me be clear: I have yet to run across a single thing I could do in Eclipse that I can't do in Android Studio; there is some loss of productivity while I retrain my mind -- for example CTRL-H (seriously control + H?) is no longer the shortcut for search.

I've compiled some of my most used Eclipse hotkeys and their Android Studio counterparts. (Note: I use a Mac for my development machine, and some of the key conventions differ on the Windows versions of Eclipse as well as IntelliJ.)

Auto code completion

Just like Eclipse ADT, Android Studio supports smart code completion. If you start typing a method name CTRL-SPACE will kick code completion into effect, often completing your command if the intent is obvious. However, unlike Eclipse, which will automatically suggest a quick fix if you fat finger say a method name, to get this behavior in Android Studio you will need to select the errant code and then hit ALT-ENTER.

Method documentation on mouse hover

By default Eclipse ADT will pop up the method definition or signature if you hover over the method name inline. Android Studio requires you to again click the method of interest and then hit F1. I have found it is possible from the editor preferences to automatically pop up the method definition on mouse hover by checking a box; unlike Eclipse, this contextual help window doesn't go away when you move the mouse to a new item, and it obscures your view, so I find it more convenient to invoke the help with F1 when I require it.

Auto import

I am a big fan of the way Eclipse suggests and manages imports on the fly. While it may have changed in the latest update to Android Studio, in previous versions, this functionality was not turned on by default. It's there, and if you are missing it (like I was) go to Preferences | Editor | Settings | Auto Import and check all the available options.

Search

While it always drove me batty that Eclipse decided CTRL-H was the ideal shortcut for advanced search / find functionality, eventually my brain accepted it. IntelliJ uses the more sensible CMD-SHIFT-F for find. For me, even with the extra key thrown into the combination, it feels more natural.

More shortcuts

There are other shortcuts that will come in handy as you become more familiar with Android Studio. JetBrains, the company responsible for IntelliJ, has a Confluence page that covers basic and advanced editing features. And for those of you who absolutely positively love Eclipse, the folks at JetBrains were nice enough to include a key template that reconfigures the IDE to use Eclipse hotkeys where possible. You can find this setting under Preferences | Keymap.

If you have been using Android Studio for a while, do you have any tips for our readers? Sound off in the discussion.

Automatically subscribe to TechRepublic's The Android Expert newsletter.