Android

Sum of two Numbers App in Android

Before starting example using Android SDK, you have to make sure that you have setup your Android development environment properly in your system and you you have knowledge with Eclipse IDE.

The first step is to create a simple Android Application using Eclipse IDE. Follow the option File -> New -> Project and finally select Android New Application wizard from the wizard list.

Name your application as SumApp

a7-1

Create blank activity with MainActivity

a6-1

Next, follow the instructions provided and keep all other entries as default till the final step. Once your project is created successfully, you will have following project screen:

a5

Anatomy of Android Application


You should be aware of a few directories and files in the Android project:

a4

S.N.
                      Folder, File &
Description
1
src
This contains the .java source files for your project. By
default, it includes an MainActivity.javasource
file having an activity class that runs when your app is launched using the
app icon.
2
gen
This contains the .R file, a compiler-generated file that
references all the resources found in your project. You should not modify
this file.
3
bin
This folder contains the Android package files .apk built by the ADT during the build
process and everything else needed to run an Android application.
4
res/drawable-hdpi
This is a directory for drawable objects that are designed for high-density
screens.
5
res/layout
This is a directory for files that define your app’s user interface.
6
res/values
This is a directory for other various XML files that contain a collection of
resources, such as strings and colors definitions.
7
AndroidManifest.xml
This is the manifest file which describes the fundamental characteristics of the
app and defines each of its components.

The Manifest File

AndroidManifest.xml is a required file for every application. It sits in the root folder for an application, and describes global values for your package, including the application components (activities, services, etc) that the package exposes and the implementation classes for each component, what kind of data each can handle, and where they can be launched.








Activity_main layout File:

Choose graphical view in activity_main fil