I haven’t done any Android programming, but then I do know one thing about frameworks: the main method is typically located somewhere deep within the plumbing code that comes with the framework, and from which application programmers are insulated. This is deliberate, so that the application programmer is shielded from the framework’s complexity.¬†This allows the framework to finely control when and where the application code (written by the app programmer) starts running, after all the internal inits, checks, et al, have been done. The same plumbing code in the framework later also takes care of all the resource cleanups that are required to be managed when the application is closed by the user.

Typically, there is a method for the application programmer to start their own app-specific coding, and this method is very helpfully put in place by the framework’s IDE for you to start coding your application. Often, you may just have to respond to events generated within the system that are routed to your event-handling code.

Original post: https://www.quora.com/How-can-an-Android-application-run-without-a-main-method/answer/Najeeb-Shaikh

Image courtesy: Icons made by Flat Icons from flaticon.com
Please spread the word among your friends & associates