Four components in the Wang Liping--android

Source: Internet
Author: User

Android The four components are calledactivity/service/broadcast recevicer/content provider

activity :activity is a window for user and application interaction, a Span style= "padding:0px; margin:0px ">activity is equivalent to one of our actual pages, When you open a screen, The previous screen is placed in a paused state and pressed into the history stack, and the user can return to the previously opened screen with a fallback operation.

activity oncreate (create), onstart (Active), onresume (recovery), onpause (pause), onstop (Stop), ondestroy (Destroy), onrestart (restart)



Service : Service is a program that can run for a long time, equivalent to a service in the background, through startservice (Intent service) can start a A Servicecan be bound by Context.bindservice () .


BroadCast Recevicer intent as a trigger event, accept the relevant message, do some simple processing, converted into a notification , unified broadcastreceiver to make the app respond to an external event. broadcast Receiver via to notify the user that these things have happened, broadcastreceiver is registered in two ways, One can be registered in androidmanifest.xml , and another can be used in code at run time context.registerreceiver () to register. Users can also pass context.sendbroadcast () put their own intent broadcasts broadcast to other applications.


Content provider : A content provider that can share its own data to external calls and interfaces to third-party applications that provide data access.

Four components in the Wang Liping--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.