Thank you a lot Dianne and Rich for helping: I think that this discussion will be helpful to many other Android developers ;)
I understand that I was not successful in explaining the core issue. Let me attempt to rephrase it in a more appropriate way. As far as I understand, when an application process starts, its "Application.onCreate()" method is invoked, right? Since I do not want to check that my application process is properly initialized in all my Activities, BroadcastReceivers, IntentServices, Services, ContentProviders..., I decided to initialize some variables during that "Application.onCreate()" method. Since the application process can be killed any time by the OS while it was running an Android Task, it may happen that when the end-user presses its launch icon, or access to it via the "latest task" feature (long-pressing the "home" button), the lastly stacked Activity on the Task stack may be the first application Activity to be recreated, and I would like to prevent from having to check the initialization in all "Activity.onCreate()" methods, for instance (even if it is just one line of code to invoke a static method, because, for me it's a bad design, since I may forget to insert that line of code in all Activities). You may say that I should derive from a common Activity which would check for the initialization: once again, I do not like this solution, because I have various natures of Activities, like a MapActivity, a ListActivity, a GroupActivity, a PreferenceActivity, and I'd prefer not introduce a basis class for each Activity nature. This discussion also applies to the BroadcastReceivers, IntentServices, Services, and ContentProviders: I do not want to check for the initialization nor derive from abstract class which would do the work. I prefer the concept of interception, and I prefer to have a centralized place where I know that all my applications components will go through, in order to check for the initialization. That is why I overload the "Application.onCreate()" method, because it meets all my requirements (except for the ContentProvider that may be invoked before the "Application.onCreate()" method has finished its execution), and that I know that this initialization checking and execution just takes less than 10 ms. However, one of my application component, an IntentService, needs to run in another process (this is a constraint that I cannot bypass): this is the exception to my rule, i.e., it does not need the initialization to be run, and moreover it should not. How can I do so that the initialization check in my "Application.onCreate()" method be not invoked in that special case, please? I hope that my question is now clearer. Thank you for reading, and hopefully for proposing a solution. Regards, Édouard -- 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