I am quite confused about the event-driven programming paradigm of Android? Who is in charge of invoking the lifecycle handlers (onCreate(), onResume() etc.)? Is it the Android OS? Or the Dalvik VM which runs in the application process?

Can anyone answer my question or direct me some related resources? Thank you very much.

有帮助吗?

解决方案

At OS boot, a process called the Zygote is created. This process waits for incoming requests for app startups. Once it receives a request, it forks a VM instance based on the Zygote VM itself. Thus every app is its own process with it's own sandboxed VM.
It is this VM process that starts the onCreate() (and other relevant methods) which subsequently start the app.

Source: My resarch on the topic.

其他提示

The activity lifecycle is a collection of methods the OS calls throughout the lifecycle of an activity.

go to this Link Activity Lifecycle

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top