Late last year the JetBrains team released IntelliJ IDEA 12, the latest version of its Java IDE.
Java today has many roles, but two dominate. One is server-side programming using one of many Java application servers, while the other is coding Android apps. IntelliJ IDEA has the former role well covered, though this is the first release with full support for Java 8, but Android development is less mature, though it seems to me that it has now come together.
The big new feature for Android is the inclusion of a visual user interface designer. Standard Android layouts are defined in XML, and the IntelliJ IDEA tool is a two-way designer that lets you flip between visual and code views. I found it to work well.
The starting point for an Android app is the New Project dialog. This hooks into the Android SDK installed on your machine. In this example I am using Android 4.1 “Jelly Bean”.
Next, you select a target device (actual or emulated) with the option to create a “Hello World” activity as a starting point. The project then opens in the IDE.
It is not obvious how to get from here to the new UI designer. The New dialog will not help you.
What you do is to hold down Control and click the word main in setContentView(R.layout.main).
The default layout is a LinearLayout. If you are making, for example, a calculator, you probably want a TableLayout or GridLayout. I found it useful to be able to flip between text and design views. The design view can save a lot of typing. The text view is excellent when you want to see the exact code and perform text operations like copy or search and replace.
I was surprised not to find an instant way to create an event handler (unless I missed it) but this is easily done in the editor. With IntelliJ IDEA, it is always worth pressing Alt-Enter as this will offer a prompt of potentially useful actions.
I hooked up an event listener and was able to set a breakpoint and debug my app:
Is this the best IDE for Android development? There is the mighty Eclipse of course; but while Eclipse can do most things, I am not surprised to see comments like this:
Usability: Intellij user experience is much easier to grasp. The learning curve in Intellij is by far faster. It seems using Intellij makes developing easier and more natural. Dropdowns, code completion, quick view, project wizards, etc, are all possible both in Eclipse and Intellij, but the experience in Intellij is much more satisfying.
That said, Eclipse is completely free, whereas the free Community Edition of IntelliJ IDEA has limitations – but as far as I can tell, Android support is included.