本文介绍了如何测试您的应用程序被杀害并重新启动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想测试我的应用程序被杀害并重新启动在非主要活动pretending到该应用程序只是简单地恢复用户的情况。任何人都知道如何做到这一点?的想法没有,我找到了工作,因为他们都杀了应用,然后在恢复的主要活动。

I'd like to test the case of my app being killed and restarting in a non main activity pretending to the user that the app was simply resumed. Anyone know how to do this? None of the ideas I've found work as they all kill the app which then resumes at the main activity.

推荐答案

我居然发现了这个更方便。您的应用程序被杀害,并且在previous活动重新启动,所以只需添加一个调试按钮来调用这个:

I actually found this more convenient. Your app is killed and restarted in the previous activity, so just add a debug button to call this:

System.exit(0);

如果你想在当前活动重新启动,刚开始的另一项活动,然后立即调用它。

And if you want to restart in the current activity, just start another activity then immediately call this.

这篇关于如何测试您的应用程序被杀害并重新启动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 17:44