在onStop()
方法中调用finish()
方法时会发生什么?
是否会导致anr:表示它调用
onPause()->onStop()->finish()->onPause()....
或者它完成 Activity :意味着它直接调用
onDestroy()
实际上,我想在 Activity 完全不可见时完成。
编辑:
See this scenario, I launch an activity B whose layout height and width is smaller than activity A, so activity A is partially visible and when I press the home button activity A becomes completely invisible. At this point I want to close activity A, so that it do not call onRestart().
提前致谢。
最佳答案
它完成 Activity 并调用onDestroy()
。如果您想在 Activity 不可见时完成 Activity,则应在 onStop()
中调用 finish()
。
关于android - 在 onStop() 中调用 finish(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20904546/