Basic Components of Android Application

Dinki Agrawal
3 min readJul 14, 2021

--

Android Applications

are developed using JAVA, Kotlin, and C++. Application components are very essential for building Applications. They work as an entry point for users or system to enter your application. There are four different types of components. Each component has its own purpose and distinct life cycle.

1. Activities

An activity is a class that is considered as an entry point for users that represents a single screen.

public class MainActivity extends Activity { 
//code
}

2. Services

A service is a component that runs in the background, it acts as an invisible worker of our application. It keeps updating data sources and activities.

To execute services, extend the Services class in your sub-class:

public class MyService extends Services { 
//code
}

3. Content Providers

Content Provider is a component that allows applications to share data among multiple applications. It hides the details of the database and can be used to read and write private data of the application which is not shared.

To implement this, extend ContentProvider in your subclass:

public class Provider_Name extendsContentProvider {
//code
}

4.BroadCast Receiver

Broadcast Receiver is a component that responds to broadcast messages from another application or the same system. It can also deliver broadcasts to applications that are not running.

To implement this, extend BroadcastReceiver to your receiver:

public class Broadcast_Name extendsBroadcastReceiver {
//code
}

Some additional components :-

1. Intents

It is an inter-application message passing framework for communication between android components.

2. Widgets

Widgets are variations of Broadcast Receivers and essential aspects of home screen customization.

3. Views

View is responsible for drawing and event handling. They are rectangular elements on the screen. Some of the views are EditText, ImageView Button, CheckBox and ImageButton.

4. Notifications

It alerts users when the application is not visible or is inactive. This alert flashes on the screen and then disappears. Example — Notification of the new incoming message popped on the screen.

5. Fragments

A fragment is a portion of the total user interface. Users can combine more than one fragment in a single activity and these fragments can be reused in multiple activities.

6. Layout XML Files

Layout is the structure for the user interface in the application. XML files provide different types of layouts for the different type of screen, it also specifies which GUI component, an activity or fragment holds.

7. App APK files

Apk stands for Android Package. Apk file is the package file format that contains the program’s code, resources, assets. The Android operating system uses them for installing mobile applications and middleware.

8. Resources

Resources in Android is for defining Images, texts, string values. Everything is defined in the resource file and it can be referenced within the source code. We will learn about Android Resources, in detail in our next upcoming article on Resources.

--

--