Thanks for the replies guys! Well Satya you have a point to call super before any code at onCreate()... but MB also has a point :) when calling onDestroy... onStop.... calling super at the end...
I guess since it's not really enforced I'm not sure it really matters? I tried both ways and it works but I'm afraid to maybe get some memory leaks or things that are not apparent now but can cause harm or unexpected issues on some users... Mark, not calling super at onCreate will lead to a crash... :) I got maybe a little more insight on this but still no definite answer... maybe is not much of a big deal? :P On Aug 1, 1:50 am, MB <manoj.bi...@gmail.com> wrote: > By this logic, super.onStop and super.onDestroy would need to be > called after the implementation of the more specific class. > > On Jul 31, 7:50 pm, Satya Komatineni <satya.komatin...@gmail.com> > wrote: > > > Probably there are exceptions to every rule. > > > In this particular instance I would probably have the base class > > complete its work before I do the work of the derived. May be a poor > > parallel, but if I am constructing a multi-story house, I would want > > to finish the base floors and move on to the upper floors. > > > Another thought is, a derived class comes later in conception than the > > base class. So a derived class can anticipate what a base class does > > on the otherhand baseclass designers would not have known what the > > derived class would have done. > > > In case of a constructor, the compiler will tell you that you have to > > call the super first. > > > However if I know that I am not altering the state of the base class, > > such as logging a message, I could put that method either before or > > after. > > > Also if you want the behavior of the base class to be a default one > > after you have exhausted your options such as attending to menus, then > > you want to call the base super last. > > > In the particular case of "onCreate", as it resembles construction, I > > go with calling the "super" first. > > > Hope this reflection helps > > > Satya Komatinenihttp://www.satyakomatineni.comhttp://www.androidbook.com > > > On Sat, Jul 31, 2010 at 10:26 PM, Moto <medicalsou...@gmail.com> wrote: > > > This might be a simple question but I'm seeing the super call at the > > > end of the overwritten function and also at the start of the > > > function. What is recommended? any differences on this? > > > > I feel very beginner with this question... :P > > > > i.e. > > > > �...@override > > > protected void onCreate) > > > { > > > super.onCreate(); > > > // some code > > > } > > > > or > > > > �...@override > > > protected void onCreate() > > > { > > > // some code > > > super.onCreate(); > > > } > > > > -Moto > > > > -- > > > You received this message because you are subscribed to the Google > > > Groups "Android Developers" group. > > > To post to this group, send email to android-developers@googlegroups.com > > > To unsubscribe from this group, send email to > > > android-developers+unsubscr...@googlegroups.com > > > For more options, visit this group at > > >http://groups.google.com/group/android-developers?hl=en > > > -- > > Satya Komatinenihttp://www.satyakomatineni.comhttp://www.androidbook.com > > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en