Android application components
Application component is an Android application's basic building blocks. These components are loosely coupled by the application manifest file organization. AndroidManifest.xml describe each component of the application, and how they interact.
The following are the four main components that can be used in Android applications.
Module | description |
---|---|
Activities | Description UI, user interaction with the machine and the processing of the screen. |
Services | Background processing operations associated with the application. |
Broadcast Receivers | Android operating system and handles the communication between applications. |
Content Providers | Deal with the problem of data and database management. |
Activities
An activity to identify a single screen user interface has. For example, a mail application can contain a list of activities for new mail, another activity used to write the message, and then a campaign to read the message. When an application has a redundant activities, one of which will be marked as the time when the application starts is displayed.
An activity class is a subclass of Activity, as follows:
public class MainActivity extends Activity { }
Services
Service is running in the background for a long time to perform assembly operations. For example, the service can be a user when using a different program to play music in the background, or in activities to obtain data through the network, but not blocking user interaction.
A service subclass Service class, as follows:
public class MyService extends Service { }
Broadcast Receivers
Broadcast receiver simply the response from other applications or systems to send broadcast messages. For example, an application can initiate a broadcast to allow other applications to guide some of the data has been downloaded to the device, and you can use them for. Therefore, the broadcast receiver will intercept these communications and to take appropriate action.
Broadcast receiver is a subclass of class BroadcastReceiver, each message in the form of the Intent object to the broadcast.
public class MyReceiver extends BroadcastReceiver { }
Content Providers
Content provider components by requesting data from one application to another application. These requests by the ContentResolver class methods to deal with. The data can be stored in the file system, database, or other elsewhere.
The content provider is a subclass ContentProvider class and implement a standard API, so other applications to perform the transaction.
public class MyContentProvider extends ContentProvider { }
We will be in a separate section through the details of these tags to cover the application components.
Accessory assembly
There are some components of attachment for the above-mentioned entities, among them the logic and structure of the connection between them. These components are as follows:
Module | description |
---|---|
Fragments | It acts on behalf of a campaign or a portion of the user interface. |
Views | Draw on the screen UI elements, including buttons, lists, etc. |
Layouts | Control screen format, the appearance of the view display View inheritance. |
Intents | Messages connection between components. |
Resources | External elements, such as string resources, constant resource and image resources. |
Manifest | Application configuration file. |