There are four important component types in Android

Source: Internet
Author: User
Tags sqlite database

There are four important component types in Android (tutorials are explained in detail in the Android Development tutorial ):activities,Services, Broadcast receivers,Content providers.

1, multiple activity can be combined to use and form a combined application, but they are still independent of each other. They all inherit from the base class activity.
2, in general, when there are multiple activity in an Android application, One activity is marked first and displayed to the user, and is moved to the next activity if the current activity is ready to start the next.
3, each activity has a default form, and the activity uses an extra form, such as a pop-up dialog box.
5, the elements in the form are in the form in the activity, So the program inside calls Activity.setcontentview () can.

1, the service does not need a visual user interface, it will run in the background irregularly. Each service inherits from the base class service.
2. In order for the service to run without affecting other components, they generate a large number of task threads.

Broadcast receivers
1, broadcast receiver: it is a component to receive and respond to broadcast, most of the broadcast comes from the system, for example: Change time zone, change language, low battery power, etc. In addition, the application can create broadcast, for example: Some data has been downloaded to the device, then the other applications will be notified that you can use the data. All receivers continue to broadcastreceiver from the base class.
2. Broadcast does not display a user interface directly, but initiates an activity to respond to the information they receive or use Notificationmanager to alert the user. Notification there are many ways to attract the attention of users, such as: flashing background lights, equipment, vibration, sound, etc. the most typical way is to place a conspicuous small icon in the status bar, and the user can open it to get the message.

Content providers
1. Content provider can create the useful data they need for other applications. This data can be saved to a file system, SQLite database, or other meaningful means.
2. Content provider continues to be contentprovider from the base class, and they all implement a standard set of interfaces that enable applications to retrieve and save the data. However, in actual development, those methods cannot be called directly, and they need to be called with objects of class Contentresolver.

This article is from the "Add Language" blog, please make sure to keep this source

There are four important component types in Android

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.