Core Android Application Components: An Introduction to Activities, Services, and Broadcasts.

TYPES OF ANDROID APPLICATION COMPONENTS

Welcome back, guys! My name is Subhajit and in this video, we’ll discuss the different types of Android application components. There are four main components that we use in our applications, namely –

1) Activities
2) Services
3) Broadcast receivers
4) Content providers

Let’s have a closer look at each of them.

ACTIVITIES:
Activities are the pages in our application where we do all the designing stuff to handle the user interactions. An activity has two layers – frontend and backend. We use XML for the frontend and Java or Kotlin for the backend. Simply put, an activity is nothing but a screen or page. We’ll cover this topic in detail in a separate video.

SERVICES:
The second component is a service. This component is very powerful and can perform long-running operations in the background without providing any user interface. Examples of this component can be seen in media player apps or download manager apps. These are long-running operations that continue even when we close the app. In such cases, we should use services.

BROADCAST RECEIVERS:
This is another crucial component for the application. Using this component, our app can send and receive broadcast messages from the Android system or from other apps. These messages are sent automatically when various system events occur. For example, when the device starts charging or receiving messages, Android sends a broadcast on that particular event.

CONTENT PROVIDERS:
This component allows other apps to manage a shared set of app data that could be stored in a SQLite database or in a file system or web server. It’s important to note that all four components should be registered or binded in the manifest.

In addition to these four components, we also have a few additional components, such as manifest, fragments, views, layouts, intents, and resources.

Manifest:
The manifest holds the configuration of an app. We must declare all of its components in the AndroidManifest.xml file.

Fragments:
A fragment is a part of an activity that can be used to design our app’s UI more structurally. It also has its own lifecycle, just like an activity.

Views:
Any UI element that is drawn on the screen, including buttons, images, labels, etc., is called a view.

Layouts:
Layouts are used to construct the design in which views could be fit in.

Intent:
The intent is a messaging object that can be used to request an action from another app component. For example, opening an activity from another activity or starting a service from an activity.

Resource:
Resources are external elements such as strings, colors, constraints, drivable images, and so on. It’s always a good practice to externalize app resources so we can minimize them independently.

In summary, application components are the necessary building blocks an Android application consists of. All components are bound by the application manifest file, which also contains the app’s metadata. In our upcoming videos, we’ll discuss more about each of these individual components. If you have any questions or suggestions, please leave them in the comments section. If you found this video helpful, hit the like button, subscribe, and share it with your friends. See you soon in the next one!

Check Also

3 Cara Cek IMEI Samsung Termudah, Semenit Auto Beres!

Mau tahu bagaimana cara cek IMEI Samsung termudah? Pastikan kamu baca ulasan berikut ini untuk …

Leave a Reply

Your email address will not be published. Required fields are marked *