On Mon, Aug 2, 2010 at 10:12 PM, Moto <medicalsou...@gmail.com> wrote:
> I guess since it's not really enforced I'm not sure it really matters? > Usually, no, it doesn't matter. Of course you could run into issues where your derived functions depend on state that is altered by calling super. This does not seem to be the case in Android, at least as far as the life cycle methods are concerned, AFAIK. > 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... > I think you're over-thinking the issue. In general, I'd say just call super first and then do your work, unless you have a good reason to do otherwise (the documentation tells you to or you know the implementation and know why you're doing it differently). > Mark, not calling super at onCreate will lead to a crash... :) > To clarify, Mark said: > There's nothing in Java that forces you to have super.onCreate() at the > beginning. Which is true - a) *Java* does not require this - you will compile and run fine. The crash you get when omitting onCreate is an *Android* requirement. And b) it's not required to be at the beginning of the function as calling super in the constructor is. > I got maybe a little more insight on this but still no definite answer... > maybe is not much of a big deal? :P > It's really not, unless it breaks your app. It probably won't though. ------------------------------------------------------------------------------------------------- TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago transit tracking app for Android-powered devices -- 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