MY mENU


Thursday 9 February 2012

Important Android components


Activities: A UI component that corresponds to display screens. Each activity displays one screen to the user. When the activity is not running, the operating system can kill it to save memory space.


Views are user interface widgets, e.g. buttons or text fields. The base class for all Views is android.view.View. The layout of the Views is managed by subclasses of type android.view.ViewGroupsViews often have attributes which can be used to change their appearance and behavior.


INTENTS are asynchronous messages which allow the application to request functionality from other components of the Android systen, e.g. from Services or Activities. An application can call a component directly (explicit intent) or ask the Android system to evaluate registered components for a certainIntents (implicit intents). For example the application could implement sharing of data via an Intent and all components which allow sharing of data would be available for the user to select. Applications register themselves to an intent via an IntentFilterIntents allow to combine loosely coupled components to perform certain tasks.
Broadcast Receiver: Is a reaction to an event. For example, phone ringing. Broadcast Receivers enable the development of event-driven applications. They let applications do some actions in reaction to external events by listening to broadcast Intents that match specific filter criteria (as we will see hereafter). When triggered by an event a Broadcast Receiver will automatically start the application component best matching the related Intent Filter. Broadcast receivers are usually registered in the AndroidManifest.xml
file (described afterwards) of the application, which does not have to be running for its broadcast receivers to be called; the system will start the application, if necessary, when a Broadcast Receiver is triggered. Broadcast Receivers do not display a UI, although they may use the Notification Manager to alert the user if something interesting has happened.
Services: The tasks that run in the background.Services are the invisible workers of an application used to perform regular processing that needs to continue even when the Activities aren't active or visible. A Service is long lived code without a UI but rather running in the background for an indefinite period of
time. However it’s possible to communicate with a service through an appropriate interface.
 For example, an MP3 players running in the background while the user has gone to use other application on mobile device.
Content Provider: Shares data with other activities and services.Content Providers form shareable data stores. They are the preferred way for sharing data across application boundaries. This means that it’s possible to configure Content Providers to permit access from other applications and use Content Providers exposed by others to access their stored data. The data can be stored in the file system, in an SQLite database or otherwise. Android devices include some native Content Providers allowing to
share useful databases like contact information. A Content Provider can be made synchronizable by setting the proper attribute of the tag provider in the manifest. However a built-in synchronization service seems to be still unavailable at the moment so that one should implement its own synchronization logic to get a Provider actually synchronized.
Widgets are interactive components which are primary used on the Android homescreen. They typically display some kind of data and allow the user to perform actions via them. For example a Widget could display a short summary of new emails and if the user select a email it could start the email application with the selected email.


Notifications allow to signal users without interrupting their current Activities. They’re the preferred technique for getting a user’s attention from within a Service or Broadcast Receiver. For example, when a device receives a text message or an incoming call, it alerts you somehow (by flashing lights, making sounds, displaying icons, or showing dialog messages).

No comments:

Post a Comment