One cool feature of Android is that one application can share its features with other applications. But this can be done if it was allowed to share. For example, if your application needs to display a scrolling list of images and another application has developed a suitable scroller and made it available to others, you can call upon that scroller to do the work, rather than develop your own. Your application doesn’t incorporate the code of the other application or link to it; rather, it simply starts up that piece of the other application when the need arises.
This can only be done if the system is able to start an application process when any part of it is needed by another application. Whenever such a request arise system will instantiate the java object for that part.
Therefore, unlikely applications on most other systems, Android applications don’t have a single entry point. Such as a main() method, for example. Rather, applications have essential components that the system can instantiate and run as needed. There are four types of components as follows;
1. Activities
An activity presents a visual user interface for one focused task the user can undertake. For example it may present some input boxes or menu items where user can work with.
2. Services
A service doesn’t have a visual user interface. This type of a component runs in the background for an indefinite period of time. Each service extends the Service base class.
3. Broadcast Receivers
A broadcast receiver basically does nothing, but receives and reacts to broadcast announcements. Generally broadcasts originate in the system; for example, announcements that the battery is low, that a picture has been taken or the time zone has changed. Although we can also initiate broadcasts within our application, all receivers extend the BroadcastReceiver base class.
4. Content Providers
A content provider makes a specific set of application’s data available to other applications. The data can be stored in the file system, in a SQLite Database or in any other manner that makes sense. The content provider extends the ContentProvider base class. However applications don’t call methods implemented by content providers directly. Instead they use a ContentResolver instant to communicate with any content provider.
Whenever there’s a request that should be handled by a particular component, Android makes sure that the application process of the component is running or starting it if necessary, and that an appropriate instance of the component is available or creating the instance if necessary.


Recent Comments