3.7. Android application components

发布时间 :2025-10-25 12:24:11 UTC      

Application components are the basic building blocks of an Android application. These components are organized by loosely coupled application manifest files. AndroidManifest.xml Describes each component of the application and how they interact.

Here are four main components that can be used in Android applications.

module

Description

Activities

Describe UI and handle the interaction between the user and the machine screen.

Services

Handles background operations associated with the application.

Broadcast Receivers

Handles communication between the Android operating system and applications.

Content Providers

Deal with data and database management issues.

3.7.1. Activities

An activity identifies a single screen with a user interface. For example, a mail application can contain an activity to display a new mailing list, another activity to write a message, and another activity to read a message. When the application has more than one activity, one of them is marked to be displayed when the application starts.

One activity is Activity Class, as follows:

public class MainActivity extends Activity {

}

3.7.2. Services

A service is a component that runs in the background and performs long-term operations. For example, a service can be a user playing music in the background while using different programs, or obtaining data through the network during an activity without blocking user interaction.

One service is Service Class, as follows:

public class MyService extends Service {

}

3.7.3. Broadcast Receivers

The broadcast receiver simply responds to broadcast messages from other applications or systems. For example, an application can initiate a broadcast to let other applications know that some data has been downloaded to the device and is available to them. Therefore, the broadcast receiver will intercept these communications and take appropriate action.

The broadcast receiver is BroadcastReceiver Class, with each message beginning with a Intent Object to broadcast.

public class MyReceiver  extends  BroadcastReceiver {

}

3.7.4. Content Providers

The content provider component provides data from one application to another by request. These requests are made by ContentResolver Class to handle the. This data can be stored in a file system, database, or other place.

The content provider is ContentProvider Class and implements a standard set of API for other applications to perform transactions.

public class MyContentProvider extends  ContentProvider {

}

We will cover the application components through the details of these tags in separate chapters.

3.7.5. Accessory component

There are some attachment components for the entities mentioned above, the logic between them, and the construction of connections between them. These components are as follows:

module

Description

Fragments

Represents an action or part of a user interface in an activity.

Views

UI elements drawn on the screen, including buttons, lists, etc.

Layouts

Inheritance of View that controls the screen format and shows the appearance of the view.

Intents

Message connections between components.

Resources

External elements, such as string resources, constant resources, and picture resources.

Manifest

The configuration file for the application.

Principles, Technologies, and Methods of Geographic Information Systems  102

In recent years, Geographic Information Systems (GIS) have undergone rapid development in both theoretical and practical dimensions. GIS has been widely applied for modeling and decision-making support across various fields such as urban management, regional planning, and environmental remediation, establishing geographic information as a vital component of the information era. The introduction of the “Digital Earth” concept has further accelerated the advancement of GIS, which serves as its technical foundation. Concurrently, scholars have been dedicated to theoretical research in areas like spatial cognition, spatial data uncertainty, and the formalization of spatial relationships. This reflects the dual nature of GIS as both an applied technology and an academic discipline, with the two aspects forming a mutually reinforcing cycle of progress.