一.递归退出
递归执行方式:A调B,B跳C,C跳D。
当在D里面退出,就D跳C,C跳B,B跳A,然后就退出了(一个一个退)
效果图:
![](https://img-blog.csdn.net/20170617211339528?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvWXVIdWlMaW5n/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center)
实现代码如下:
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.zking.android13_activity.MainActivity"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="这是MainActivity"
android:textSize="30sp"
android:background="#00ff00"/><!--为了看效果的TextView-->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/tv_main_text"
android:textSize="25sp"/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="(当前为A页面)跳自己"
android:onClick="jumpMain"/><!--跳转(跳自己 即A跳A)-->
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="跳B页面"
android:onClick="jumpB"/>
<Button
android:layout_width="match_parent"
android: