Android Programming – Core Components

Through my previous Articles, we have discussed developing a sample Android Application, “MyApp”; Build & Run the Application in Android Studio. In this Article, I am going to explain, what are the core components in Android application.

Lets’ take our already built Application “MyApp”; here is the Android view, shows the list of components created in our Application.

Android Application - Android View
Android Application – Android View

Observe that, the Project has two primary groups; one is “app” group and the other one is “Gradle Scripts” group. “Gradle Scripts” are the scripts to automate the build process. We can skip this now. We focus on “app” group.

app” group contains different sub-groups which contains different components; “manifests“, “java” and “res“. Why java? We use different languages to develop Android Applications. Our Project was developed using java, hence you are seeing “java” sub-group inside “app” group. We also can use C++ or Kotlin to develop Android Applications. Let me explain these in Android terminology.

Components are the building blocks of an Android application. Mostly the Android applications built with below components:

  • App components
  • Manifest file and
  • App resources

Let me brief each of these components here. We will discuss more about these in my upcoming Articles.

App components

App components are the main building blocks of an Android application. We developed our Application in our previous Article, using Java language. Hence you see “java” sub-group in above picture. Under “java” you see; “LoginActivity” & “MainActivity” components. These are the java classes created and we call these Activities; which is one of the App component.


Basically below are the App components:

Activities

Activity represents an user interface to allow the user to interact with the Application. From above, LoginActivity and MainActivity are the Activities defined to interact with the Application.

Services

Have you ever used stock ticker.? It displays continuously the latest stock prices; without interrupting the user interaction. This is happening, because there is a service running in the background; picking up the stock prices and giving to Activities to display them. That means, Services run in background to keep the Android Application active and to do some activities in the background.

Receivers

We can call these as Broadcast Receivers, enable an Android Application to receive events or messages from the System or from other Applications.

Providers

Providers are used to provide something to its’ own Applications or other Applications. What is that something? The something is the data. Primarily these are dealing with content or data; we call them as Content Providers.

These are App components. Don’t worry; we will discuss them with examples; through relevant Articles.

Manifest file

Have you observed “AndroidManifest.xml” file, in above picture? This is the manifest file where Android Application components are declared. This is the file Android will look into first, before start the Application; and based on the declarations in the manifest Android will run the Application.

These files are stored in “manifests” group.

App resources

Other files related to the Application; like images, icons, styles etc, should be part of Application resources. App resources will be used to change the look and feel of the Application.

App resources are stored in “res” group.

These are the Core Components constitute a complete Android Application.

We discuss more about these components with working examples through my upcoming Articles.

[..] David

2 Comments

Add a Comment

Your email address will not be published.