OdeToCode IC Logo

IntelliJ IDEA for Android Development

Monday, January 10, 2011

imageI really like IntelliJ IDEA - and the free community edition now supports Google Android development.

Part of the reason I like this IDE is because it feels familiar. I've learned the JetBrains sense of style from using ReSharper in Visual Studio, and seeing familiar commands for navigation and refactoring is comforting. It's great to have the muscle memory for Alt+Enter and Alt+Insert, and the auto-completion works well both for Java code and XML resources (which is a tremendous help for someone new to the platform, like myself).

Now I find myself in the wiring up UI events in Java, which feels awkward and verbose coming from C#. I'm also learning the difference between a click and a long click in Android. If you return false from the long click event handler, the event is unhandled and the regular click event handler will also fire. If you return true, the system considers the event handled and the regular click event doesn't fire.


public class MainActivity extends Activity
    public void onCreate(Bundle savedInstanceState)     {


        textView = (TextView)findViewById(R.id.text);
        button =(Button)findViewById(R.id.button);


    View.OnClickListener buttonClickListener = new View.OnClickListener(){
        public void onClick(View v) {

    View.OnLongClickListener buttonLongClickListener = new View.OnLongClickListener() {
        public boolean onLongClick(View v){
            textView.setText("Long click");
            return true;

    private Button button;
    private TextView textView;