1 刚发现一个令人惊奇的事儿,TabActivity中的,无论用getTabHost().setCurrentTab(2);设置当前的subactivity为第几个,例如第二个,可是第一个subactivity仍然会create,目前尚不知道create之后的情况以及是否和SetDefaultTab有关。
2 ActivityGroup里面的
@Override
public void onBackPressed() {
// TODO Auto-generated method stub
super.onBackPressed();
}
不会被调用。
3 Activity有两个可重载的函数,貌似很有意思啊
Called when activity start-up is complete (after
onStart() and onRestoreInstanceState(Bundle) have been called). |
|
Called when activity resume is complete (after
onResume() has been called). |
使用还得斟酌下。
4 Activity的生命周期是栈式的,文档上很详细,create->start->resum->pause->stop->destroy, 省电锁定的时候进入pause态,主动压入后台则是进入stop态(home键,不知道返回键是否),直接调用finish进入destroy,内存在后台被强制回收时不会调用destroy,若有程序突入前台那么当前程序是否就如pause还是stop?
有意思的是ActivityGroup与SubActivity的生命周期关联,假设ActivityGroup group,SubActivity sub:
groupCreate->subCreate->subStart->groupStart->subResume->groupResume->subPause->groupPause->subStop->groupStop->subDestroy->groupDestroy
从subA1切换到新的subA2,subA1Pause->subA2Create...
然后相互之间的切换就是先pause再resume的形式。
subA1与subA2都启动后,停留在subA1,然后finish则:
[subA1-pause]->[group-pause]->[subA1-stop]->[subA2-stop]->[group-stop]->[subA1-Destroy]->[subA2-Destroy]->[group-Destroy]
如果停留在subA2则是
[subA2-pause]->[group-pause]->...
就是这样了。