How onCreate works is described on the Activity page of the Android Developers Guide. In particular, here:
onCreate (Bundle) is where you initialize your activity. Most importantly, here you usually call setContentView (int) with the layout resource defining your user interface, and using findViewById (int) to retrieve the widget in that user interface that you need to interact with the software.
In a sense, you can consider this method as a constructor for your activity, since initialization is performed there (see Activity Life Cycle ).
For the core, consider it hidden from you. Typically, you register for user interface elements, such as buttons or text fields, and then act on the input from these user interface elements. These listeners handle calls to your methods, which can manipulate data or change the way the user interface is displayed.
source share