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. |