How to start the activity that is last opened when launch an application?
问题 I designed an app with several activities. There is only an activity instance in the back stack at any time. When I quit the application from an activity named AcitivityOne, how could I launch the application with ActivityOne next time? 回答1: The fast method, is that in your onCreate() put those flags after setContentView() : if ((getIntent().getFlags() & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) != 0) { finish(); return; } Also you can create a SharedPreferences with the Activity last oppened as