Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在activity_main.xml之前制作了三个.xml文件,并使用线程为每个xml文件一个一个设置了5秒的计时器。因此需要15秒才能到达主要活动。
我使用的 EXIT 按钮有问题
system.exit(0); //behaving similar as finish()
但它不是从整个应用程序返回到以前的 xml 文件。我想一键退出整个应用程序。
在您的中,您Manifest.xml应该添加标签。此外,您不应调用,而应仅使用.android:noHistory="true"<activity>system.exit(0)finish()
Manifest.xml
android:noHistory="true"
<activity>
system.exit(0)
finish()
通过这样做,活动将不会被添加到后退堆栈中,因此,按下退出按钮(或后退按钮)将使用户退出应用程序。
像这样试试
moveTaskToBack(true);
供参考moveTaskToBack