Application components are the essential building blocks of Android app development. Each of the components is a different point by which the system can enter your app. Although each one of them exists as its own entity and plays a specific role, there are some which depend on each other, and not all of them are actual entry points.
There are five different types of app components, each with its own purpose and life cycle that defines how they are created and destroyed. They are as follows:
This is a component that represents a single screen with a user interface (for instance, an email app may have one activity showing a list of new emails, another activity composing emails, and another one reading emails). Activities work together to form a cohesive user experience in the app. However, each one of them is independent.
This is a background component that performs tasks for remote processes or long-running operations. It doesn't have a graphical user interface (for instance it might play music in the background while the user is in a different app).
This is the component that manages a shared set of app data. Through this component, the data that you store either in the file system, on the web, an SQLite database can be queried or even modified (as long as the content provider allows it). This component is also useful for writing and reading data that is not shared and is private to your app.
This component is responsible for responding to system-wide broadcast announcements. The system generates the majority of the broadcast receivers, and while they don't have a user interface, they can create a status bar notification that alerts the user when a broadcast event occurs. In general, it serves as a link to the other components and performs only minor tasks.
The asynchronous message referred to as intent activates 3 of the 4 components (i.e. services, activities, and broadcast receivers). Intents also bind individual components to one another at runtime whether the component belongs to your app or not.
Types of Bindings
When we use intents, we are actually performing an action in one activity and starting another activity as a result. There are a variety of ways in which this can occur.
- Direct Binding for Activities: the activity or the app generating the intent will directly start an activity from another application
- Direct Binding for Services: the app generating the intent could directly start the service
- Broadcast: It could broadcast the event to all interested broadcaster receivers, depending on the activity that generated the intent.
Article comments
Saddam Mullick
19 Oct 2021 at 08:51 AMworth reading article...!