简体   繁体   中英

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

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..?

Thanks in Advance !

onPause is called when an activity becomes no longer the foreground Activity. onStop is called when it goes completely off screen. So a dialog activity coming up wouldn't cause onStop to be called, because some part of that activity is still visible. Now if you were to press the home button and bring up the launcher, you would see onStop called. (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. onPause/onResume are based on it being foreground.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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