Certified Android Apps Developer Android Elements

Learning Resources
 

Android Elements


Android Elements

The following gives a short overview of the most important Android elements.

Activity
An Activity represents the presentation layer of an Android application. A simplified description is that an Activity represents a screen in your Android application. This is slightly incorrect as Activities can be displayed as dialogs or can be transparent.

An Android application can have several Activities.

Views and ViewGroups
Views are user interface widgets, e.g. buttons or text fields. The base class for all Views is the android.view.View class. Views have attributes which can be used to configure their appearance and behavior.

A ViewGroup is responsible for arranging other Views. ViewGroups is also called layout managers. The base class for these layout managers is the android.view.ViewGroup class which extends the View class.

ViewGroups can be nestled to create complex layouts. You should not nestle ViewGroups too deeply as this has a negative impact on the performance.

Intents
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 based on the Intent data (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
Services perform background tasks without providing a user interface. They can notify the user via the notification framework in Android.

ContentProvider
A 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. The SQLite database would store the data, which would be accessed via the ContentProvider.

BroadcastReceiver
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.

(HomeScreen) Widgets
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.

Other
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 while Live Wallpapers allow to create annimated backgrounds.

 For Support