Android Studio Tutorial For Beginner #3: Application Components

Application component consists of essential building blocks to develop an android application. These components should be added in the manifest file. Understand manifest.xml and resources here.


Activity: It contains layout file and Java code to handle both user interaction and functionality on an application. If an application has more than one activity, then one of them should be marked as the activity that is presented when the application is launched.

Services: They handle background processing associated with an application.
For example, a service might play music in the background while the user is in a different application, or it might fetch data over the network without blocking user interaction with an activity.

Broadcast Receivers: Broadcast Receivers simply respond to broadcast messages from other applications or from the system. For example, applications can also initiate broadcasts to let other applications know that some data has been downloaded to the device and is available for them to use, so this is a broadcast receiver who will intercept this communication and will initiate appropriate action.

Content Providers: A content provider component supplies data from one application to others on request. The data may be stored in the file system, the database or somewhere else entirely.

Fragment: Represents a portion of the user interface in an Activity. Android Fragment is the part of the activity, it is also known as sub-activity. There can be more than one fragment in an activity. Fragments represent multiple screens inside one activity. Android fragment lifecycle is affected by activity lifecycle because fragments are included in an activity.

Some of the Application Components are Explained Here.

Now let’s create Your First Project. A Hello World! example:

Now create new Project in You Android Studio and open activity_main.xml in res-> layout folder.

<LinearLayout xmlns:android=""
        android:text="Hello World!"
        tools:ignore="MissingConstraints" />

Now Run your Application click on Run Icon, connect your phone via USB to your PC or learn how to run an application from android studio to real devices.

select your device

In your you will see onCreate() is @Override and has this line:


This binds your java file to your layout. R represent resources (everything in resource folder). then you have .layout to represent that this is a layout in the layout folder which is under resource folder.

0 0 vote
Article Rating
Notify of
Inline Feedbacks
View all comments

Enjoy this blog? Please spread the word :)