This is a basic problem, no difficulty, just a small logical implementation of the problem. In order to later have the need for convenient, save down. The new study students can refer to the next.
First of all, when writing a project, we usually write baseactivity, which inherits the activity of other activities and inherits Baseactivity.
So, the idea is that we write a activitycollector such a class to add and remove activity, each activity is inherited baseactivity so we can baseactivity the OnCreate method of the current
The activity is added to the collection, and we are removing it when we execute ondestory, so we can remove all the activity from this collection when we have the last interface so that there will be no open activity when you exit with one exit.
Implementation of the Activitycollector class
This class is three ways, I believe we can read and explain
Baseactivity implementation of a simple demo no other logical implementation
The class inherits this class by executing the addition and finsh of the current activity, thus managing the activity.
The activity logic for the three Tests is to inherit baseactivity and then mainactivity inside a button to open the secoundactivity and then secoundactivity Open the third atcivity, the third act Ivity inside a button is used to implement close all, this time you can call Activitycollector's Finshall () method
How to exit activity at any time, close activity before exiting activity, how to quit all activity of the program