I'm writing an application consisting of several activities and, on restarts, I'd like the application to initially display the application's activity that was the last to display in the application's previous session.
I save information about the last activity in SharedPreferences and I'm trying to start that last activity with a call to startActivity(intent) from my Application's onCreate handler. The problem is that if I don't set the intent's FLAG_ACTIVITY_NEW_TASK, the result is a run-time exception message in logcat suggesting that I should set the flag. And if I set that intent flag, the correct activity gets started but doesn't fully initialize resulting in null pointer exceptions (which don't occur when I don't attempt to start the activity from my Application class). - - - W/dalvikvm( 805): threadid=3: thread exiting with uncaught exception (group=0x4000fe70) E/AndroidRuntime( 805): Uncaught handler: thread main exiting due to uncaught exception E/AndroidRuntime( 805): java.lang.RuntimeException: Unable to create application com.test.tangled.TApplication: android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want? - - - Any tips on how to correctly start a particular activity from the Application class's onCreate handler? Thanks, Greg -- 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