In this article I am going to explain how to create and run an Android application in Android Emulator. In order to run an application we have to create an Android Virtual Device (AVD). An AVD defines the system image and device settings used by the emulator.

Perform the following steps to create an AVD:
   In Eclipse, select Window à Android SDK and AVD Manager.
  •   Select Virtual Devices in the left panel.
  •   Click New.
  • The Create New AVD dialog appears.
  •  Type the name of the AVD, such as "MyAVD_Device".
  •   Choose a target.
  • The target is the platform (that is, the version of the Android SDK, such as 2.3.3) you want to run on the emulator.
  •  Click Create AVD.
  • When you start your AVD, it seems like below: 


Create and Run an Android Application

Create a New Android Project

After creating an AVD move to the next step and create a new project in Eclipse.

1)      In Eclipse, select File à New à Project.

2)      Select Android Project and click next.

3)      After click on next, you have to enter the project details in the New Android Project dialog box. Fill in the project details with the following values:

Project name: FirstAndroidApp

Build Target: Select a platform version that is equal to or lower than the target you chose for your AVD.

Application name: FirstAndroidApp

Package name: com.example.firstApp (or your own private namespace) 

Create Activity: HelloAndroid

4)      Click Finish.


Create and Run an Android Application

Your Android project is now ready. It should be visible in the Package Explorer on the left. Open the file, located inside FirstAndroidApp à src à com.example.firstApp). Add some lines of code in order to change the UI (User Interface):

package com.example.firstApp;

import android.os.Bundle;
import android.widget.TextView;

public class HelloAndroid extends Activity {
     /** Called when the activity is first created. */
     public void onCreate(Bundle savedInstanceState) {
         TextView tv=new TextView(this);
        tv.setText("Welcome in the world of Android");
Run the Application

Now after creating an application, run an application.

Right click on the project (FirstAndroidApp) which is shown in the Package Explorer à Select Run As à Android Application.


Create and Run an Android Application

After performing the above steps you can easily learn how to create and run and simple Android application by using Eclipse IDE..


  Modified On Mar-23-2018 02:08:46 AM

Leave Comment