Search

Loading...

Wednesday, June 3, 2009

writing android hello world program using eclipse and creating Android Environment

Here is the complete steps to create and setup environment for android programming till writing a sample android application below are the easy step by step guide


Step1: Downloading required packages
First of all Download Eclipse IDE from Here and download Google Android SDK from Here

step2: Unpacking Downloaded Files
Now Extract the Android SDK and Eclipse and in the Drive ( D: or E:) which has sufficient space

step3: Create AVD follow below steps
AVD is Android Virtual Device (AVD) which is nothing but system image and device settings used by the emulator, to create AVD goto command prompt start-->run-->type "CMD" and press enter now navigate to the folder in which you have extracted android SDK example D:\android-sdk-windows-1.5_r2\tools and execute the below command as shown in below picture

in command prompt execute below line

"android create avd --target 2 --name my_avd "


step4: Configuring and installing ADT to your Eclipse Environment
1. Start Eclipse-->help-->Software updates..
2. In the window Select Available Software tab and click on Add site and enter Below URL

https://dl-ssl.google.com/android/eclipse/

2.if you get error remove "s" from https in url and click ok
4. Back in the Available Software view, you should see the plugin listed by the URL, with "Developer Tools" nested within it. Select the checkbox next to Developer Tools and click Install
5. Now in subsequent window, select and check "Android DDMS" and "Android Development Tools" Click Next.

6. Restart Eclipse

step5: Now we have to point the Eclipse to the Android SDK Directory you downloaded



1. In eclipse select window-->Prefrences and select "Android" in prefrence window
2. Now find the Browse button as shown in Above Pic and point it to downloaded SDK directory and click on apply and ok as shown in above PIC
3. Restart Eclipse

step6: Creating the Sample Android Project
1. In Eclipse select menu File-->New-->Project
2. Select Android Project" as shown in below PIC

3. Fill in the Project Details as shown in below PIC

4. Click Finish

step7: Writing Sample Android Program to print on screen
Click on the ceveniproject.java class or other name specified during the creation of the project as shown in the PIC below


and you can write the below code in the right hand side of the screen editor After writing the code in eclipse select

package com.ceveni.org;

import android.app.Activity;

public class ceveniproject extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TextView tv = new TextView(this);
tv.setText("ceveni");
setContentView(tv);
}
}


Run-->Run in the Run as window select "Android Application"


that's it if your code doesn't have any error you can see the emulator with the output as shown in below PICAnd between note that emulator takes almost 5 mins to launch show the output so be patient and wait for 5 mins after starting the emulator... if there is any mistake in this article or you can still improve it please point out

24 comments:

javaandroid said...

great article

Just for Fun ;) said...

Thanks :)

Anonymous said...

great info

videos online said...

dude this is too good.
I noticed the change in URL...and its tarunchandel.com.

This is ths the first thing I am ging to do once i come back... came online after a long time today... have been realy busy with project..and was pleasently surprised by the new look of your blog.
MAn ...you rock!!!

Some Guy said...

thanks, very helpful

Anonymous said...

what does this 5554 means???

music said...

It means the port to which the emulator is connected. You can use it if you want to launch adb commands over that emulator.

mobile application development said...

okay gone through the post, need to upload the entire code for getting the result. If any problem comes while performing the code, i will definitely write it to you.

Anonymous said...

thanks a lot boss thanks a lot...

Anonymous said...

You forgot to add:

import android.widget.TextView;

Anonymous said...

"And between note that emulator takes almost 5 mins to launch show the output so be patient and wait for 5 mins after starting the emulator."

That seems odd to me, is there a reason it's taking 5mins to launch. Will it take that long every time or just the first time emulator is launched?

Manjunath said...

My bad i forgot to add "First Time" in that sentence.

amskape said...

Hi Friends,
I run Your Code , But it shows the Default Window
of the emulatornot the code implemented in our sample. I am using windows XP , please Advise me
where I have Fault. Reply me at : anes(dot)pa@gmail.com

EWAVE said...

Thanks , for much information,

Anonymous said...

Sadly, doesn't work for me. Emulator launches but app does not run. :-(

computer hardware said...

Keep sharing such a wonderful information..!

Anonymous said...

Great

$$ YahoO_Akshay $$ said...

Sir, Appln will run... Bu always shown output as "android", even if i change the text in code ("ob.settext("asdas");)it also print ANDROID why??

andry yudha said...

I recently came accross your blog and have been reading along.
I dont know what to say except that I have enjoyed reading. Nice blog. I will keep visiting this blog very often.

Ritesh Kunte said...

Really nice article. I have a question why we extends Activity class. and why we use onCreate() method.

Anonymous said...

Thanks Budd..............

ubaid said...

Very nice,

Anonymous said...

this is the best blog i seen ever

thanks a lot

Anonymous said...

its superb....,

Post a Comment

Other Interesting Articles



Related Article Widget by ceveni

Search Powered by Google