Each action you do is triggered by a series of method calls. onCreate() is the first of these calls.
Each of your actions extends android.app.Activity either directly or by subclassing another subclass of Activity .
In Java, when you inherit a class, you can override its methods to run your own code. A very common example of this is to override the toString() method with the java.lang.Object extension.
When we redefine a method, we have the opportunity to completely replace the method in our class or extend the existing method of the parent class. super.onCreate(savedInstanceState); calling super.onCreate(savedInstanceState); , you will let Dalvik VM execute your code in addition to the existing code in the onCreate () of the parent class. If you leave this line, only your code is executed . Existing code is completely ignored.
However, you must include this super call in your method, because if you do not, the onCreate() code in the Activity will never run, and your application will run in all types of problems, such as the lack of an assigned Context (although you will end up in SuperNotCalledException before you have the opportunity to find out that you have no context).
In short, Android's own classes can be incredibly complex. The code in class classes handles things like drawing a user interface, cleaning a home, and preserving life cycles of activity and applications. super allows developers to run this complex code behind the scenes while providing a good level of abstraction for our own applications.
Raghav Sood 03 Feb '13 at 11:30 2013-02-03 11:30
source share