You have a lot of options from which to choose when deciding on features to include in your Android app, but you should keep in mind that your users will expect access to a number of common elements.
Fortunately, the Android Application Framework provides developers with programming information about several popular components to speed up the process of adding common functionality, freeing you up to dream up more elaborate features.
We put together a quick rundown of common Android components so you can get an idea of what you’ll need to include in your app to ensure that you’ll meet your users’ expectations. For more details about each component, including installation instructions, click on the links.
Intents are objects that initiate actions from other app components, either within your program (explicit intents) or through another piece of software on the device (implicit intents).
Explicit intents name specific components, leading to the completion of a desired action within the app. Implicit intents, however, specify only a general action, which is subsequently performed by another program (e.g., showing a location on a map).
Here are some of the most commonly used intents:
- Creation of alarms
- Addition of events to calendar
- Capturing/Saving pictures and video
- Selection of contacts
- Saving/Editing of contact info
- Composition of emails
- Addition of attachments to emails
- Retrieving/Opening of saved files
- Tracking duration/length of bicycle and running sessions
- Display of heart rate
- Display of locations on maps
- Playing music/videos
- Making phone calls
- Conduction of searches through apps
- Conduction of web searches
- Composition of text messages
- Addition of attachments to text messages
- Loading URLs
- Opening settings options
Activities provide users with screens on which they can interact with objects and perform actions. Activities provide a base from which intents can be deployed, enabling the app’s functionality.
Actions typically comprise a combination of the following elements:
Fragments: Reusable portions of an activity that represent the user interface. Fragments must be embedded in an activity, and their functionality is dependent on that activity’s status (i.e., an activity must be running for a fragment to be operational).
Popular examples of fragments include tabs and dropdown lists.
Loaders: Introduced in Android 3.0, loaders allow for the asynchronous loading of data for all activities and fragments. These components maintain communication with their information sources, guaranteeing the delivery of new results.
Tasks and Back Stack: A task is a collection of activities grouped together to allow a user to perform specific actions. Those activities are arranged in a back stack in the order they are opened.
Tasks and back stacks can involve activities that originate in the same app, or in a variety of programs on a device.
Overview Screen: Allows users to see recently accessed activities and tasks. On the overview screen, a user can choose to resume an activity or task, and can also remove them.
Services are components that conduct long-running operations in the background, without the inclusion of a user interface. Services can be triggered by other app components, and will continue to run when a user switches to another program.
Services are typically employed in one of these two manners:
Started: A service is started when it’s called upon to begin operating by another component. Once a service has been started, it can continue to run in the device’s background even if the component that started it is disabled.
Bound: A service is considered bound when one or more components bind to it in order to allow for multiple interactions, like sending requests and generating results. A bound service will only run when it is connected to at least one additional application.
Content providers enable users to access data within an app. These components encapsulate data and connect it to another process’s code while also defining its security. Content resolver objects must be added to an app to facilitate communication with content providers. Android includes content providers to manage audio, video, images, contact information, and other types of data.
Important examples of content providers highlighted by Android include:
Calendar Provider: A storage location for calendar events defined by users, including queries, insertions, updates, and deletions. These actions are made easier by the calendar provider because of the component’s preexisting set of intents.
Contacts Provider: A flexible component that manages a device’s stored contact information. The contact provider provides data about people entered by the user, and allows that information to be accessed within an application.
Storage Access Framework: The storage access framework (SAF) enables the easy browsing and opening of documents, images, and other files, no matter where they’re stored on a device. SAFs allow for consistent document access procedures across a device’s apps.
Widgets are small application views that are embedded in other apps, such as a music player on a device’s home screen. In order to incorporate a widget in an app, a developer must also install an app widget host.
Processes and Threads
Typically, all of an app’s components run on the same process when the program is opened on a device. However, Android allows developers to designate certain components to run in separate processes from that of their parent app, and to create new threads of execution for each of those processes.
Remember to click on the above links to find out more about implementation procedures for these components.
Thoughts on Android components? Post them in our comments section!