ComponentCallbacks与ComponentCallbacks2

本文介绍了Android中ComponentCallbacks和ComponentCallbacks2接口,强调它们在释放资源和响应系统配置及内存变化方面的作用。ComponentCallbacks2提供了更精细的内存管理,推荐用于API级别14及以上版本。
摘要由CSDN通过智能技术生成
/**
 * The set of callback APIs that are common to all application components
 * ({@link android.app.Activity}, {@link android.app.Service},
 * {@link ContentProvider}, and {@link android.app.Application}).
 */
application应用组件回调api集合接口;
ComponentCallbacks接口

包含两个接口方法:

1.

unlike activities, other components
* are never restarted when a configuration changes: they must always deal
* with the results of the change, such as by re-retrieving resources.
void onConfigurationChanged(@NonNull Configuration newConfig);

2.

/**
 * This is called when the overall system is running low on memory, and
 * actively running processes should trim their memory usage.  While
 * the exact point at which this will be called is not defined, generally
 * it will happen when all background process have been killed.
 * That is, before reaching the point of killing processes hosting
 * service and foregro
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值