Is it Possible to see whats happening in onPause of an Android Activity?

I want to know if the app is

  • closing, going to background or screen is switched off

or

  • activity is changed or Sub-Activity is closed

is there a way to get this information?

有帮助吗?

解决方案

You can see what it happening in the pause by looking at what is written in onPause().

I think you meant to ask, "What happens to the activity after onPause?"

To put it another way, you can't tell what is happening to the activity in onPause because the things that happen to the activity are taken care of in other methods. You'll have to look at these other methods at runtime.

Put a breakpoint in onRestart(), if this is hit, you can be sure that your activity was never destroyed.

Put a breakpoint in onDestroy(), if the activity is being destroyed, this breakpoint will be hit.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top