Application Fundamentals--Coordinating activities(activity实例间协调)

本文详细介绍了Android中Activity实例间的协调机制,特别是当一个Activity启动另一个Activity时,两个实例生命周期状态的变化过程。包括了onPause(), onCreate(), onStart(), onResume() 和 onStop() 方法的调用顺序。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Coordinating activities---activity实例间协调

When one activity starts another, they both experience lifecycle transitions. One pauses and may stop, while the other starts up. On occasion, you may need to coordinate these activities, one with the other.【翻译:当一个activity实例发出intent请求去启动另外一个activity实例的时候,这两个实例当前生命周期状态都将发生变化,一个进入暂停状态继而可能被stop,另一个被启动。有时候开发者可能需要两个实例相互协调。】

The order of lifecycle callbacks is well defined, particularly when the two activities are in the same process:---翻译:生命周期回调顺序是预定好的,尤其是当两个实例属于同一个进程的时候。

1. The current activity's onPause() method is called.---翻译:当前实例的onPause()方法被系统调用。
2. Next, the starting activity's onCreate(), onStart(), and onResume() methods are called in sequence.---翻译:之后,被启动的实例的onCreate(), onStart(), 和 onResume()方法被系统依次调用。
3. Then, if the starting activity is no longer visible on screen, its onStop() method is called.---翻译:然后,如果被启动的实例如果不在屏幕上显示的话,该实例的 onStop()方法被系统调用执行。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值