我刚刚浏览了 Android Developer Site,刷新了 Activity Life 循环,在每个代码示例中,在超类方法旁边都有一条注释,说“总是先调用超类方法”。
虽然这在创建半循环中是有意义的: onCreate,onStart 和 onResume,但是对于销毁半循环中的正确过程是什么,我有点困惑: onPuse,onStop,onDestroy。
首先销毁实例特定资源,然后再销毁实例特定资源可能依赖的超类资源,这是有意义的,而不是相反。但评论却表明事实并非如此。我错过了什么?
编辑 : 由于人们似乎对问题的意图感到困惑,我想知道的是下列哪一项是正确的? 为什么?
1. 谷歌建议
@Override
protected void onStop() {
super.onStop(); // Always call the superclass method first
//my implementation here
}
2. 另一边
@Override
protected void onStop() {
//my implementation here
super.onStop();
}