Yes, whether/when to call an overridden method in a subclass is one of the unfortunate consequences of using implementation inheritance. Its a shame that the Android SDK makes such heavy use of it (inheritance), Over the last 10 years I had thought enough of us in the Java world had finally gotten the message that its too fragile a way to construct a strong base for development. Most frameworks of recent years had tended to favour composition using interfaces and a set of concrete (typically final) implementations, and rightly so.
Its one of my two beefs with the Android SDK. The other being the profileration of int constants instead of enums. Trying to choose the correct constant value from an vast list of similarly named constants that all have the same type. consumes too much dev time and is fraught with danger. Just look at the number of constants in the android.media package and try to work which constants of which class go with with methods. Yes I understand the performance trade off between ints and enums, but a) We know that JVM perofrmance continues to improve b) The compiler/jvm could be tuned to cut weight from any unused portion of an enum. On Aug 4, 7:38 am, Bob Kerns <r...@acm.org> wrote: > I have found that setting the theme needs to happen before the > super.onCreate() call. > > Otherwise, I put it first -- there definitely many things that need to > happen later. > > I've complained before that this isn't well-specified. It really, > really should be. > > On Aug 3, 8:09 am, TreKing <treking...@gmail.com> wrote: > > > 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