Four components in Android

Source: Internet
Author: User

What is called the four components in Android: Activity/service/broadcast recevicer/content Provider

Activity:activity is a window that interacts with the user and the application, an activity equivalent to one of our actual web pages, and when a screen is opened, the previous screen is placed in a paused state and pressed into the history stack, The user can return to a previously opened screen through a fallback operation. Activity life cycle: "Generate, Run, destroy", but this calls many methods OnCreate (create), OnStart (activation), onresume (recovery), OnPause (pause), onStop (stop), OnDestroy (Destroy), Onrestart (restart).

Service:service is a program that can run for a long period of time, equivalent to a service in the background, through StartService (Intent service) can be launched by a services, through the Context.bindservice () A service can be bound.

Broadcast Recevicer: Accepts one or more intent as triggering events, accepts related messages, does some simple processing, transforms into a notification, and unifies the Android event broadcast model. You can use Broadcastreceiver to make the application respond to an external event. Broadcast receiver through Notificationmanager to inform the user that these things happened, Broadcastreceiver registered in two ways, One can be registered in Androidmanifest.xml, and the other can be registered using Context.registerreceiver () in code at run time. Users can also broadcast their own intent broadcasts to other applications via Context.sendbroadcast ().

Content provider: An interface that provides data access to third-party applications by sharing their own data to external calls.


Four components in Android

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.