Android user interface (UI and GUI) components
The following gives a short overview of the most important user interface Android components groups
An Activity represents the presentation layer of an Android application. A simplified description is that an Activity represents a screen in your Android application. Compared to desktop development, Activities are equivalent to Forms.
- Activity is Your application’s presentation layer.
- An Android application can have several Activities.
- An activity provides a user interface for a single screen in your application .
- Activities can move into the background and then be resumed with their state restored .
- You’ll learn more about Activities later in coming articles.
Views and ViewGroups .
An activity contains views and ViewGroups. A view is a widget that has an appearance on screen.
Examples of views (GUI graphical user interface components) are buttons, labels, and text boxes. A view derives from the base class android.view.View . Views have attributes which can be used to configure their appearance and behavior.
A ViewGroup is a special view that can contain other views (called children.) The view group is the base class for layouts and views containers. This class also defines the ViewGroup.LayoutParams class which serves as the base class for layout parameters .
- A ViewGroup is responsible for arranging other Views.
- ViewGroups can be nested to create complex layouts. You should not nested ViewGroups too deeply as this has a negative impact on the performance.
A powerful application message passing framework. Intents are used extensively throughout Android. You can use Intents to start and stop Activities and Services, to broadcast messages system-wide or to an explicit Activity, Service, or Broadcast Receiver, or to request an action be performed on a particular piece of data.
- Intents are asynchronous messages which allow the application to request functionality from other components of the Android system.
- Intent example is the 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.
The invisible workers of your application. Service components run without a UI, updating your data sources and Activities, triggering Notifications, and broadcasting Intents.
They’re used to perform long running tasks, or those that require no user interaction (such as network lookups or tasks that need to continue even when your application’s Activities aren’t active or visible.)
- Services perform background tasks without providing a user interface.
- They can notify the user via the notification framework in Android.
Shareable persistent data storage. Content Providers manage and persist application data and typically interact with SQL databases. They’re also the preferred means to share data across application boundaries. You can configure your application’s Content Providers to allow access from other applications, and you can access the Content Providers exposed by others.
- Android devices include several native Content Providers that expose useful databases such as the media store and contacts.
- 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.
Intent listeners. Broadcast Receivers enable your application to listen for Intents that match the criteria you specify. Broadcast Receivers start your application to react to any received Intent, making them perfect for creating event-driven applications.
- BroadcastReceiver registered to receive system messages and Intents.
- BroadcastReceiver will get notified by the Android system, if the specified situation happens.
- BroadcastReceiver could get called once the Android system completed some event .
Visual application components that are typically added to the device home screen.
A special variation of a Broadcast Receiver, widgets enable you to create dynamic, interactive application components for users to embed on their home screens.
- Widgets are interactive components which are primarily used on the Android home screen.
- 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.
Notifications enable you to alert users to application events without stealing focus or interrupting their current Activity.
They’re the preferred technique for getting a user’s attention when your application is not visible or active, particularly from within a Service or Broadcast Receiver. For example, when a device receives a text message or an email, the messaging and Gmail applications use Notifications to alert you by flashing lights, playing sounds, displaying icons, and scrolling a text summary. You can trigger
Other Android user interface (UI and GUI) components
Android provides 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 home screen without launching the corresponding application while Live Wallpapers allow to create animated backgrounds.
Android custom components
Android offers a sophisticated and powerful componentized model for building your UI, based on the fundamental layout classes: View and ViewGroup.
For more details about android custom components check this article : Android custom components