Could not understand how the app starts

Hi there! Guys, I though a lot, but I still can’t understand, how the app starts. In AndroidManifest we wrote that the main activity is CrimeListActivity, which extends SingleFragmentActivity. However, how the OS knows where is onCreate() method, when it doesn’t exist in CrimeListActivity?

The onCreate method exists for all Activities. It’s defined in the base Activity class that all activities subclass. So even if you don’t override it, onCreate still exists in a default form for all activities.

As I understood. Firstly, app checks the main activity from AndroidManifest.xml. Then it goes to the superclass, because we don’t override CrimeListActivity.onCreate, and founds the exact onCreate in the SingleFragmentActivity. RIght?

Yes. Correct. The only thing that I would change about your message is that it is Android that checks the AndroidManifest.xml to see which Activity to start (not the app).

1 Like