From an end-user perspective, an Android application may appear as a simple standalone application. However, any Android application consists of many components that work in the background to accomplish the given task.
Android is a free and open operating system from Google that runs on all kinds of devices from phones, to tablets and even televisions. That’s a ton of different devices you can target with just one platform! Google provides all of the stuff you need to get started building Android apps for free. You can build your Android apps on Macs, Windows, or Unix and publish your apps for next to nothing.
About Android –
- Google maintains Android, but it’s free to use. Device manufacturers and carriers can modify me, and developers can build apps for free.
- Hardware manufactures can use the Android operating system and build special hardware around it. Manufacturers can even modify Android to implement custom functionality for their devices.
- Google freely distributes the tools for you to build your own Android apps. And you can build your apps on multiple platforms: Mac, Windows, Linux…
- This is where your users can download their apps right to their phones. Google runs one market, but there are also others run by Amazon, and Verizon for example. But the biggest one is still Google’s.
The Android development environment is made up of several parts that seamlessly work together for you to build Android apps.
- Eclipse Integrated Development Environment (IDE)
- Android Development Tools (ADT)
- Software Development Kit (SDK)
- Android Packages
Android is a component based platform. Applications are built up from loosely coupled, reusable, extendable, and replaceable components that fall within well-defined roles. Following are some of the components of an Android application.
1. Activities :-
An Android activity represents any single screen on the user interface. For example, a simple login screen with username and password is one activity of the application. Applications invoke activities based on the workflow.
This is the application’s primary user interface component. Every individual screen of an Android application is derived from the Activity Java class. They are containers from Views.
2. Services :-
An Android service is a component that runs silently in the background to perform certain operations. For example, a service may fetch some remote data while the user is busy reading the content on a particular page of an application.
These are background components that behave like UNIX daemons and Windows services. They run invisible and perform ongoing unattended processing.
3. Broadcast receivers :-
Android applications continuously broadcast messages so that other applications know about the event and could possibly trigger some action. Broadcast receivers are used to respond to broadcast messages sent by other applications or by the Android system.
4. Content Providers :-
Content providers do the job of supplying data to other applications based on specific requests. Content providers are one of the best ways for cross-application data sharing. Data managers that are the recommended form of inter-application data sharing.
When Android applications share data, they rely on the content provider API to expose data within their database. For example, the Android contact content provider allows an unlimited number of applications to reuse contact persistence on the Android platform. By simply invoking this content provider, an application can integrate access to
a user’s contacts stored locally and synchronized with the Google cloud.
Applications can read and write data in content providers without having to provide their own database manipulation code. In this way, content providers provide a powerful feature that allows developers to easily create applications with sophisticated data management—in many cases, applications will end up writing very little data persistence code of their own.
5. Manifest :-
This is an XML file that contains all configuration parameters of an Android application. In Android projects, a manifest file is included with the project’s software and resources when the project is built. This file tells the Android system how to install and use the software in the archive that contains the built project. The manifest file is in XML, and the ADT plug-in provides a specialized XML editor to edit the manifest.
Applications may need to store significant amounts of data to control their runtime behavior. Some of this data describes the application environment: the app name, the intents it registers, the permissions it needs and so on. This data is stored in a file called the manifest. Other data might be images to display or simple text strings, indicating what background color or font to use. These data are called resources.
Together, all this information forms the context of the application, and Android provides access to it through the Context class. Both Activity and Service extend the Context class, which means that all activities and services have access to Context data through the this pointer.
As we’ve seen, the four components of Android applications – Activity, Service, ContentProvider, and BroadcastReceiver – provide the foundation of Android application development. To make use of any of them, an application must include corresponding declarations in its AndroidManifest.xml file.
A Typical Source Tree
The source code for Android applications almost always makes use of the following directory hierarchy:
– layout/ … contains application layout files …
– drawable/ …contains images, patches, drawable xml …
– raw/ … contains data files that can be loaded as streams …
– values/ … contains xml files that contain string, number values used in code …