Android Application Components
In android development, application components are the fundamental and most important building block to develop the android application. These all components are defined in the AndroidManifest.xml file. This file describes all the components and also describes how they interact to each other. The following are the main application components are as follows which can be used in any android application:
- Activity is the screen that provides the user interface.
- Activity is like the java frame or java swing frame.
- For example, a mobile contact activity can have the first name, last name, Email; work-fax etc options are available in this form. Using this, we can create a new contact using this activity.
- An application can have more than one activity but has one main activity.
- An activity can be implemented by extending the Activity class.
- This is the most important application component that runs in the background.
- This component is used to perform the long-running operations.
- For example, suppose we are downloading a file from the internet and also playing music; these both will perform in the background. Hence these both works can be done without blocking user interaction with the activity.
- A service can be implemented by inheriting the Service class.
- In android, broadcast receiver is used to respond to the messages from the system or respond to the other applications.
- For example, we can send the message from the cloud and the applications are able to receive that message and can use that data.
- A broadcast receiver can be implemented by extending the BroadcastReceiver class.
- This application component is used to transfer the data from one application to another application on requests.
- ContentResolver class provide the methods to handle these requests.
- We can store the data in the file system or in database.
- We can use content provider by extending the ContentProvider and set of APIs that provides the facility to perform transactions.
The other application components are fragments, views, layouts, intent, resources etc.