Android and NetBeans

Hey guys I’m writing this post after few weeks. This time I thought of writing a post about Android. I bought a HTC Hero, the first HTC android phone with the Sense UI . Since the day I bought the phone I wanted to write an app for the phone, but with work didn’t get much time to do that. Finally I found some time to kill, so as a result of that I’m writing this post.

First I wrote my Hello World app using Eclipse. Though it’s a powerful IDE I don’t like the idea of using Eclipse. Therefore I looked for a plugin to NetBeans to develop my first Android app. Among the first few search results I found this article How to setup Netbeans for Android development and it worked the magic. Even though the above mentioned post was written for NetBeans 6.5 it works for NetBeans 6.8 too.

Note: you have to install Android SDK to start. Follow this link to install the SDK Installing the SDK

Ok then lets start developing our first android app; to start work first you have to install NetBeans and have to install the Android plugin by following the above link.
Open NetBeans File -> New Project and you’ll get the screen below select Android as the category and Android Application as the Project and then click next.

New Project

And the next part is the Name and Location window its as same as a usual NetBeans project therefore I’m not gonna explain that to you!

Name and Location

OK now lets take a look at the first code this is really simple, the below image is the class which you have to edit.

Java class

you have to add these lines of code which is demonstrated on the following image

TextView tv = new TextView(this);
tv.setText(“Hello Android”);
Button bt = new Button(this);
bt.setText(“GO”);
setContentView(bt);

Finished code

and then you have to hit the run button and it will start the Android emulator

Running App

Try more and enjoy
bye for now
:D

Note: This link has more and further details on android development

~~ Rusiru Boteju ~~

Follow

Get every new post delivered to your Inbox.