OK, I see.  So basically, by calling super.onCreate
(savedInstanceState) one is making sure that any code in the
superclass gets run, and then the stuff that is custom to the new
class.

Thanks.

On Dec 13, 1:31 pm, Mark Murphy <mmur...@commonsware.com> wrote:
> 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 android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to