Question

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.

Was it helpful?

Solution

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.

OTHER TIPS

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

go to this Link Activity Lifecycle

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top