简体   繁体   English

当对话框显示为活动时,OnStop()vs OnPause()

[英]OnStop() vs OnPause() when dialog is displayed as a activity

http://stackoverflow.com/a/7384782/869501 http://stackoverflow.com/a/7384782/869501

This Excellect answer says onPause() is called when Dialog takes foreground and Dialog defined as an activity..Does this say that the activity calls onStop() after onPause() after when dialog(dialog-as-activity) even when this dialog doesn't take up Full-Screen..? 这个Excellect的答案说,当Dialog取得前景并将Dialog定义为一个活动时,会调用onPause()。这就是说,当对话框(对话框为活动)之后,活动在onPause()之后调用onStop(),即使这个对话框没有占用全屏..?

Thanks in Advance ! 提前致谢 !

onPause is called when an activity becomes no longer the foreground Activity. 当活动不再是前台活动时调用onPause。 onStop is called when it goes completely off screen. onStop在完全离开屏幕时被调用。 So a dialog activity coming up wouldn't cause onStop to be called, because some part of that activity is still visible. 因此,即将出现的对话活动不会导致调用onStop,因为该活动的某些部分仍然可见。 Now if you were to press the home button and bring up the launcher, you would see onStop called. 现在,如果您按下主页按钮并调出启动器,您会看到onStop被调用。 (This is assuming you're making a standard dialog activity that has a transparent background that shows the previous activity.) (这假设您正在制作一个标准对话框活动,该活动具有显示上一个活动的透明背景。)

Basically onStop/onStart are based on the activity being visible. 基本上onStop / onStart基于可见的活动。 onPause/onResume are based on it being foreground. onPause / onResume基于它是前景。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM