当前位置:网站首页>Activity的四种状态
Activity的四种状态
2022-08-11 06:44:00 【是小A】
一个Activity实质上有四种状态:运行,暂停,停止,销毁
运行中:
在屏幕前台(位于当前任务堆栈的顶部)
此时的Activity位于栈顶,是可见的,并且可以与用户进行交互
暂停:
失去焦点,但仍然对用户可见(覆盖Activity可能是透明或未完全遮挡)
当Activity失去焦点,不能与用户交互了,但依然可见,就处于暂停状态
当一个新的非全屏的Activity或者一个透明的Activity放置在栈顶,Activity就处于暂停状态;
这个时候Activity的各种数据仍然保存着;
只有在系统内存极低的情况下,系统才会自动的销毁Activity
停止:
完全被另一个Activity覆盖
当一个Activity被另一个Activity完全覆盖,或者点击HOME键 退入了后台,这时候的Activity处于停止状态
此时的Activity的各种数据仍然保存着
当系统别的地方需要用到内容时,系统会自动的去销毁Activity
销毁:
退出,完全销毁
当我们点击返回键或者系统在内存不够用的情况下就会把Activity从栈里移除并销毁,被系统回收,这时候Activity就处于销毁状态
边栏推荐
猜你喜欢
随机推荐
sql--Users who have purchased more than 3 times (inclusive) within 7 days (including the current day), and the purchase amount in the past 7 days exceeds 1,000
微信小程序功能上新(2022.06.01~2022.08.04)
Resolved EROR 1064 (42000): You have an error in. your SOL syntax. check the manual that corresponds to yo
Spatial Pyramid Pooling -Spatial Pyramid Pooling (including source code)
强烈推荐一款好用的API接口
Daily sql-employee bonus filtering and answer rate ranking first
从何跟踪伦敦金最新行情走势?
Unity游戏排行榜的制作与优化
基于FPGA的FIR滤波器的实现(4)— 串行结构FIR滤波器的FPGA代码实现
【推荐系统】:协同过滤和基于内容过滤概述
Internet phone software or consolidation of attack must be "free" calls security clearance
Attitude solution - gyroscope + Euler method
NFT 的价值从何而来
Daily sql: request for friend application pass rate
How Unity programmers can improve their abilities
How do you optimize the performance of your Unity project?
详述 MIMIC护理人员信息表(十五)
PIXHAWK飞控使用RTK
软件测试基本流程有哪些?北京专业第三方软件检测机构安利
Go语言实现Etcd服务发现(Etcd & Service Discovery & Go)