NetBeans 6.1: Working with Google´s Android SDK, Groovy and Grails

For a beta release NetBeans 6.1 is surprisingly stable and mature but not mature enough to start any new project from scratch as the project configuration files are not modified as intended yet. Everybody who has ever tried the SWT-based Eclipse IDE under Linux, knows how bad usability, system integration and quality assurance can be and will therefore appreciate the Swing widget toolkit based NetBeans as an alternative IDE to Eclipse. However Swing is also not the best GUI toolkit under Linux but definitely better than SWT!

As you can see on the image bellow, you can also get Groovy (Java-based scripting language developed to fulfill RAD requirements) support in NetBeans 6.1 by downloading a correspondent plugin:

NetBeans-6.1 with Groovy and Grails support

Grails framework (the Groovy analogon to Ruby on Rails) and Google´s Android SDK support are available via plugin as well.

There is also a NetBeans 6.0.x DEB package for Ubuntu available, if you add the following line to your "/etc/apt/sources.list" APT repository file:

deb http://archive.canonical.com/ubuntu hardy partner

Below you can see Google´s "Hello World" application for its Android mobile phone framework I have tested in NetBeans 6.1. But I have to admit that only the run mode works fine -- the debug mode is not supported by NetBean´s Android plugin yet.

HelloAcitivity.java class:

package com.google.android.helloactivity;

import android.app.Activity;
import android.os.Bundle;

/**
* A minimal "Hello, World!" application.
*/
public class HelloActivity extends Activity {
    public HelloActivity() {
    }

    /**
     * Called with the activity is first created.
     */
    @Override
    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);

        // Set the layout for this activity.  You can find it
        // in res/layout/hello_activity.xml
        setContentView(R.layout.hello_activity);
    }
}

Project directory/res/layout/hello_activity.xml:

<EditText xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/text"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:textSize="18sp"
    android:autoText="true"
    android:capitalize="sentences"
    android:text="@string/hello_activity_text_text" />

Project directory/res/values/strings.xml:

<resources>
    <string name="hello_activity_text_text">Hello, World!</string>
</resources>

...as you can see, you have to edit three files, to write a "Hello World" app in Android.

Comments

  1. can u tell me how to install android in netbeans 6.1 step by step because i m new to linux and android

    ReplyDelete

Post a Comment

Popular posts from this blog

Tuning ext4 for performance with emphasis on SSD usage