Components of an Android Application


It is very important to understand the components of an android
application because Your Android applications will be built from these four basic component types and these are discussed below:

Activities

Activities are pieces of executable code that come and go in time,instantiated by either the user or the operating system and running as long as they are needed. They can interact with the user and request  data or services from otheractivities or services via queries or Intents (discussed in a moment).Most of the executable code you write for Android will execute in the context of an Activity. Activities usually correspond to display screens: each
Activity shows one screen to the user. When it is not actively running, an Activity  can be killed by the operating system to conserve memory.

Services

They are executable pieces of code that usually run in the background from the time of their instantiation until the mobile handset is shut down. They generally don’t expose a user interface.The classic example of a Service is an MP3 player.Your applicationmay need to implement Services to perform background tasks.
Broadcast and Intent Receivers

These respond to requests for service from another application. A
BroadcastReceiver responds to a system-wide announcement of an event. These announcements can come from Android itself (e.g., battery low) or from any program running on the system. An Activity or Service provides other applications with access to its functionality by executing an Intent Receiver, a small piece of
executable codethat responds to requests for data or services from other activities.
The requesting(client) activity issues an Intent, leaving it up to the Android framework to figureout which application should receive and act on it.Intents are one of the key architectural elements in Android that facilitate the creation of new applications from existing applications (mobile mashups). You will use Intents in your application to interact with other applications and services that provide information needed by your application

Content providers

These are created to share data with other activities or services. A
content provideruses a standard interface in the form of a URI to fulfill requests for data from otherapplications that may not even know which content provider they are using. For example, when an application issues a query for Contact data, it addresses thequery to a URI of the form:content://contacts/peopleThe operating system looks to see which applications have registered themselves as content providers for the given URI, and sends the request to the
appropriateapplication (starting the application if it is not already running). If there is morethan one content provider registered for the requested URI, the operating systemasks the user which one he wants to use.

Note: An application doesn’t have to use all of the Android components,
but a well-writtenapplication will make use of the mechanisms provided, rather than
reinventing functionalityor hardcoding references to other applications.

 

Advertisements

2 Responses to “Components of an Android Application”

  1. ahmed Says:

    this is very useful article for those who are the beginners of android development so keep it up

  2. ahmed Says:

    informative article

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: