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