Are there any scenarios on Android where a process can be instantiated (classes loaded, etc.) and a non-main activity launched without going through the main activity?
Background: my app has a single main activity (android:name="android.intent.action.MAIN" and android:name="android.intent.category.LAUNCHER"), some secondary activities, and a preferences class providing static methods meant to be called from anywhere. These static methods' implementations require a Context, and so the class has a static Context member s_context; the static methods assert that s_context is non-null before using it. The very first thing I do in my main activity's onCreate() method is pass getApplicationContext() into the preferences class so it can set s_context. The main activity launches a secondary activity that calls the preference class's static methods. Sometimes -- never in an emulator, and only after my app's been running for a while and moved to the background several times -- those asserts fail. This indicates that somehow the secondary activity is running but that the main activity never ran. (Or that the preferences class was gc'd and reloaded, but java doesn't work that way AFAIK.) Is it possible that Android is launching my app directly into the secondary activity, e.g. because that's that activity that was running when it was killed? Alternatively, is there a way my main activity can be launched and its onCreate() not called? I'm just beginning to read about singleTop and other alternative launch modes. I'm not setting these at the moment... Thanks, --Eric -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

