Android in Eclipse

Step 1: Go to android.com and download the android sdk by navigating like follows,

Image

 

 

Image

 

 

Image

Download the sdk and install it in your system.

Note:

1. Give the path as c:\program files (if os installed on c drive).

2. Install all the packages of sdk that you have downloaded.

Step 2: Download the eclipse from eclipse.org

Image

 

Step 3: Open the eclipse and go to Help -> Install New Softwares ->Add,

Image

 

Give ok and you can see the window like this,

ImageCheck the developer tools check box then give next and finish.

Step 4: Go to windows -> preferences and choose android. If you get any errors then check that the path of the android sdk that you have installed on your system.

Image

Step 5: Then start programming with android in eclipse.

File -> new -> project (android application) -> HelloWorld once it is opened,

copy the following code,

package com.example.helloworld;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.widget.TextView;

public class HelloWorld extends Activity {

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_hello_world);
TextView agnPrint = new TextView(this);
agnPrint.setText(“Hello Naveen Welcome to Android Development”);
setContentView(agnPrint);
}
}

Step 6: Go to run -> android application, first time it usually ask us to add AVD (Android Virtual Device) for target display, so add it as follows,

Image

Then click the manager and click the new then you can see one window, just fill that window options as like follows,

Image

 

you have successfully added AVD target.

Step 7: Finally if you run your helloworld program then you can see the output as follows,

Image

 

 

Thanks for reading this post….!!

Leave a Reply