Four components in Android and four components in Android

Source: Internet
Author: User

Four components in Android and four components in Android

In Android, the four components are called Activity/Service/BroadCast Recevicer/Content providerActivity: activity is the window for the user to interact with the application. An activity is equivalent to a Web page, when a screen is opened, the previous screen will be paused and pushed into the history stack. You can return to the previously opened screen through the rollback operation. Activity lifecycle: "Generate, run, and destroy". However, many methods such as onCreate, onStart, onResume, and onPause are called) onStop, onDestroy, and onRestart ). Service: A Service is a program that can run for a long time. It is equivalent to a backend service. You can use startService (Intent Service) to start a Service through Context. bindService () can be bound to a Service. BroadCast Recevicer: receives one or more intents as trigger events, receives related messages, performs some simple processing, converts them into a Notification, and unifies the Android event BroadCast model. BroadcastReceiver can be used to make the application respond to an external event. Broadcast Receiver uses icationicationmanager to notify users of the occurrence of these events. BroadcastReceiver can be registered in AndroidManifest. xml, and the Context can be used in the runtime code. registerReceiver. You can also broadcast your intent broadcasts to other applications through Context. sendBroadcast. Content provider: Content provider, which can be used to share its own data for external calls and provide data access interfaces to third-party applications.

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: info-contact@alibabacloud.com 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.