2. Android
components
The following gives a short overview of the most important Android
components.
Activity represents the presentation layer of an Android application. A
simplified (and slightly incorrect) description is that an Activity is a screen. This is slightly incorrect as Activities can be displayed as Dialogs or can be transparent. An Android
application can have several Activities.
Views are user interface
widgets, e.g. buttons or text fields. The base class for
all Views is android.view.View. Views often have attributes
which can be used to change their appearance and behavior.
A ViewGroup is responsible for arranging other Views e.g. a ViewGroup is a layout manager. The base class for a layout manager is android.view.ViewGroups. ViewGroup also extends View. ViewGroups can be nestled to
create complex layouts. You should not nestle ViewGroups too deeply as this has a negative impact on the performance. ListView, TableLayout, GridView,…
Intents are asynchronous messages which allow
the application to request functionality from other components of the Android
system, 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
certain Intent (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 IntentFilter.
Intents allow to combine loosely coupled components to perform certain tasks.
Services perform background tasks without providing a user interface. They can
notify the user via the notification framework in Android.
ContentProvider provides a structured interface to application data. Via a ContentProvider your application can share data with other applications. Android
contains an SQLite database which is frequently used in conjunction with a ContentProvider to persist the data of the ContentProvider.
BroadcastReceiver can be
registered to receive system messages and Intents. A BroadcastReceiver will get notified by the Android system, if the specified situation
happens. For example a BroadcastReceiver could
get called once the Android system completed the boot process or if a phone
call is received.
Widgets are interactive
components which are primarily 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 selects an
email, it could start the email application with the selected email.
Android provide many more components but the list above describes the
most important ones. Other Android components are "Live Folders" and
"Live Wallpapers". Live Folders display data on the homescreen
without launching the corresponding application.
No comments:
Post a Comment