当我单击标题栏上的后退箭头而不是转到上一个面板时,它会退出应用程序



.当我单击标题栏上的"后退箭头"时,它必须从教师管理面板移回学生管理面板,但它退出了系统,我已经尝试了很多但无法解决这个问题,正如我自己作为 android 初学者介绍的那样。请帮帮我!

 <activity
  android:name=".teacher_admin_panel"
  android:label="TeacherAdminPanel"
  android:parentActivityName=".Student_AdminPanel"/>
 //This is the code for Androidmanifest.xml

  getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setDisplayShowHomeEnabled(true);
 //This is the code for backarrow in the TeacherAdminPanel

当你转移活动时,你是否完成了你要去的活动?如果完成活动,则将其从活动后退堆栈中删除,因此您没有可返回的内容,因此应用程序将关闭。

https://developer.android.com/guide/components/activities/tasks-and-back-stack

最新更新