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 Komatineni http://www.satyakomatineni.com http://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 Komatineni http://www.satyakomatineni.com http://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