Android Application Components

In this tutorial you will learn about the Android Application Components and its application with practical example.

Android Application Components

Table Of Contents

Core Building Blocks of Android

Application components are very important part or Core Building Blocks of an Android Application. Its an entry Point for System or Users from which they can enter in App.
There are four main Important Components for an APP

  1. Activity
  2. Services
  3. Broadcast receivers.
  4. Content Provider.

  1. Activity: An Activity is a class, Its represent single screen. Parent class for Any Activity is Activity, Means You need to implement an Activity as a subclass of Activity, like

    public class DemoActivity extends Activity {

}

 

If you created an activity so you must declare it Manifest.xml file, Later on we will discuss about this.

 

2.Services: It’s a long running background Process which perform operations in background. Service does not provide User Interface. For Creation of Service we need to create Subclass of Service or we can also use existing Subclasses of Services.

 

 

  1. Broadcast Receivers: Broadcast Receiver respond on broadcast message of other applications or it can be system message. Suppose you clicked on any file for download and after download it will inform you that file is ready to use.
    A Broadcast Receiver is implemented as a subclass of Broadcast Receiver and each broadcast message received as a intent.

 

 

It Override OnReceive() method where each message will be received. Example for Broadcast Receiver is Alarm Manager. There is no need to run that app till alarm goes off, Once you schedule am alarm it will inform you about upcoming event .

 

4.Content Provider : Using Content Provider we can share data between Application. So basically Content Provider are used to share data between Applications. Content Providers use different ways to store data like Database, Files etc.

 

Additional Components
1. Fragment :
Fragment is a Sub Activity or parts of Activity.

  1. Intents : It Facilitate communication between components, It is Used to invoke components. Uses of Intent are: Starting an Activity, Starting a Service ,Delivering a Broadcast etc.
    Types of Intent : Explicit Intents, Implicit Intents .

3.Views : Views are basic building block for UI Components .Views are drawn on Screen ,It includes Buttons, Widgets, etc.
4.Layouts: Layout is a visual structure for UI. It is associate with Activity, Fragment, Dialogs, etc.
You can create Layouts in two ways:
1. Using XML
2. At Runtime.

5.Resource: It is an very useful component for An App. Using Resource you can import Pictures, Strings, Constant .

6.Manifest : Manifest.xml file is used to provide essential information about App. Its content information about your package .

In this tutorial we have learn about the Android Application Components and its application with practical example. I hope you will like this tutorial.