Doughy wrote:
> I'm trying to understand the code for the basic onCreate function that
> is part of every application.
>
> @Override
> public void onCreate(Bundle savedInstanceState) {
> super.onCreate(savedInstanceState);
> setContentView(R.layout.main);
> }
>
> I understand the @Override, and the function declaration. It's the
> second line that I am confused about:
>
> super.onCreate(savedInstanceState);
>
> First of all, what is super? Secondly, why is it necessary to call
> another onCreate inside of the overridden onCreate function. Can
> someone explain to me what is happening here?
The pseudo-variable super represents the superclass. By calling
super.onCreate(savedInstanceState), you are "chaining to the
superclass", calling its constructor before performing the guts of yours.
http://java.sun.com/docs/books/tutorial/java/IandI/super.html
--
Mark Murphy (a Commons Guy)
http://commonsware.com
_The Busy Coder's Guide to Android Development_ Version 1.9 Available!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---