APPLICATION FUNDAMENTALS OF ANDROID
Application Components
Applicationcomponents are the essential building blocks of an android application. Each
component has its own importance. Some of the component have some interface
through which user can access the application and some of them have no User
interface but they play an important role while running of an application as
well as during the development.
There
are four different types of application components having distinct purpose
among themselves and has a distinct life cycle during they created and
destroyed.
Here are four components :
. Activity
This
is the primary classes which provide the graphical user interface to the user
and captured the user interaction through that interface. Activity usually
implements a single , focused task that user can do like dial a number or
opening of browser etc. Activity is the main class user see when they run the
application. Activities are designed to provide a graphical user interface or
GUI to the user. It enable user to give and receive information to and from an
application. Remaining three components has no graphical user interface. Let’s
took an example of Whats-app application in which one application shows the
recent chats another activity show the contacts available into the Whats App,
another one to read the particular chat. Collectively they provide the great
user experience.
Services
services
are the long running process which run into the background or to perform task
for different process. A service has no user interface .e.g. A service might
play music in the background while the user in the different application.
Broadcast Receiver
Listens
to and responds to the events that happen on device. That events is the system-wide broadcast announcements to
which our broadcast receiver responds. Many broadcast systems originates from
the systems for e.g. When Image was captured , battery is low etc.
Content Provider
It
manages the shared set of application data. You can store your data in file
system , SQLite database , on the web ,on the cloud and you can easily access
that data via your application. Through
the content provider other application can query your data or modify if
contents provider allows it. Content provider manager is available to manage
user contact information's.
Building an Android application
Android Build process provides projects and module build setting so that our android application complied and packed to get .apk. Android build process process flow :
Creating an android Application
Creating an android application includes following steps :
- Define the resources
- Implement application classes
- Package Application
- Install and Run Application
Define Resources :
Resources are the non-source code entities many difference resource types such as Layout ,Strings , Images , Menus and Animations. Resources allows app to customized for different devices and users.
We can categorized the resources into default and alternative resources. Default resources are those who belongs from device configuration and alternate resources are those which is manually configured apart from the device configuration.
Implement Classes :
Implementation of classes usually involves at leats one activity. Activity initialization code usually in onCreate. Now lets us see what's the flow of onCreate :
1. Restore the saved state
2. Set content View
3.Initialise the UI elements
4.Link UI element to code actions
Package the Application :
System package application components and resource into a .APK file. Developer specify required application information in a specified file name as AndroidManifest.xml.
Android Manifest file includes the all relevant information about the Application such as name , icon etc and required permission application feature and Minimum and maximum API level.
Android Manifest file includes the all relevant information about the Application such as name , icon etc and required permission application feature and Minimum and maximum API level.
Install and Run :
From the eclipse framework run the application an Android application via Emulator or Device.
Running through device you need to activate the USB debugging option from the Device setting.


