Create the first Android application in Eclipse

In the previous articles: “how to install eclipse on windows”, we know how to install and set up the environment for creating Android apps. In this article, we will create the first Android application, which displays the string “my first application” to the screen.

1. Create android application in Eclipse:

In Eclipse, you choose File – New – Project

Create the first Android application 1

And choose Android Application Project:

Create the first Android application 2

 

In New Android Application screen, enter the information like below

Create the first Android application 3

  • Application Name: The name of the application.
  • Project Name: The name of the project.
  • Package Name: The name of the package.
  • Minimum Required SDK: The smallest API version required to run the application, it will block users to use smaller versions.
  • Target SDK: API version that applications designed to run. The application will run API from the Minimum Required SDK  to Target SDK.
  • Compile With: API version used to compile the application.
  • Theme: choose a theme to use with applications.
  • Done, select the Next button to pass the next screen.

Create the first Android application 4

  • In this screen.
  • Button “Create custom launcher icon”: allows to change the application’s icon.
  • Button “Create activity”: create an activity for application.
  • Button “Mark this project as a library”: This project created a library, not the application.
  • Button “Create Project in a Workspace”: save your project in the Eclipse workspace.
  • Done, select the Next button to pass the next screen.

Create the first Android application 5

  • In this screen, we will select the icon for the application. We can choose from an available icon (png), from Clipart or from the font.
  • Done, select the Next button to pass the next screen.

Create the first Android application 6

  • In this screen, select the button “Create Activity” allows creating an Activity for applications available, we can choose:
    • Blank Activity: Activity blank.
    • Fullscreen Activity: Activity when running on will occupy the entire screen.
    • Master / Detail Flow: Activity form Master / Detail.
  • In this example, we will choose Blank Activity.
  • Done, select the Next button to pass the next screen.

Create the first Android application 7

  • In this screen:
  • Activity Name: The name of the Activity will be created upon completion Wizard
  • Layout Name: The name of the xml file management interface that corresponds to the Activity
  • Navigation Type: select None – type navigation will be used in the application
  • Complete, select Finish to complete the Wizard button, we will return to the Eclipse environment

2. Write Android Application in Eclipse:

Open res -> layout -> activity_main.xml to customize the interface.

Create the first Android application 8

  • In this screen
  • Graphical Layout: we can design the interface of Android applications by drag and drop, choose the corresponding controls in the left window
  • Activity_main.xml: we will create the look of the application by direct description in xml file.

Create the first Android application 9

  • In screen activity_main.xml.
  • <TextView> show label.
  • <android:text> description string displays.
  • The string “@ string / hello_world” description string displayed declared in strings.xml.

Create the first Android application 10

Create the first Android application 11

AVD will launch and install the program HelloWorld on, now, we unlock the app (left click mouse click on the image and drag the lock out). After unlocking finished HelloWorld application will launch and display the results.

 

Add Comment