当前位置:网站首页>Four states of Activity

Four states of Activity

2022-08-11 07:51:00 is a small A

An Activity has essentially four states: running, paused, stopped, destroyed

Running:

In the foreground of the screen (at the top of the current task stack)

The Activity at this time is at the top of the stack, is visible, and can interact with the user

Pause:

Loss focus, but still visible to user (overlaying Activity may be transparent or not fully occluded)

When an Activity loses focus and cannot interact with the user, but is still visible, it is in a paused state

When a new non-fullscreen Activity or a transparent Activity is placed at the top of the stack, the Activity is in a paused state;

At this time, all kinds of data of Activity are still saved;

Only when the system memory is extremely low, the system will automatically destroy the Activity

Stop:

Completely covered by another Activity

When an Activity is completely covered by another Activity, or click the HOME button to exit the background, the Activity at this time is in a stopped state

The various data of the Activity at this time are still saved

When the system needs to use the content elsewhere, the system will automatically destroy the Activity

Destroy:

Exit, completely destroyed

When we click the return button or the system will remove the Activity from the stack and destroy it when the memory is not enough, it will be recycled by the system. At this time, the Activity will be in the destroyed state

原网站

版权声明
本文为[is a small A]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/223/202208110644322684.html