The Building Blocks of Android Application


The easiest way to think of an Android Activity is to relate a visible screen to an Activity The building block of the user interface is the activity. You can think of an activity as the window or dialog in a desktop application. While it is possible for activities to not have a user interface. There will one activity(.java file) extends the class Activity for one Screen(.xml file). An Android application will often contain more than one Activity that menace more than one screen. Each Activity displays a user interface and responds to system and user initiated events.
Intents used to assist in navigation from one activity to the next Intents are system messages, running around the inside of the device, notifying applications of various events, from hardware state changes (e.g.,an SD card was inserted), to incoming data (e.g., an SMS message arrived). You create your own intent object, to launch other activities.
Service, which runs in the background and does not generally present a direct User Interface. Services, on the other hand, are designed to keep running, independent of any activity. You might use a service (extends Service class) for checking for updates to time, or to play back music.
If an application desires to receive and respond to a global event, such as the phone ringing or an incoming text message, it must register itself as an BroadcastReceiver. An application registers to receive Intents in a couple of different manners:

The application implements a <receiver> element in the AndroidManfest.xml file which describes the BroadcastReceiver’s class name and enumerates its IntentFilters. Remember, the IntentFilter is a descriptor of the Intent an application desires to process. If the receiver is registered in the AndroidManifest.xml file, it does not have to be running in order to be triggered when the event occurs as the application is started automatically upon the triggering event. All of this house-keeping is managed by Android. AndAn application registers itself at runtime via the Context class’s RegisterReceiver method also.
Content Providers
Content providers provide a level of abstraction for any data stored on the device that is accessible by multiple applications. The Android development model encourages you to make your own data available to other applications, as well as your own ‚ building a content provider lets you do that, while maintaining complete control over how your data gets accessed.