android - onStart和onStop在奇怪的地方调用

时间:2014-09-08 08:51:38

标签: android android-activity

我在开始一项新活动时收到这个非常奇怪的日志,我似乎找不到任何解释这种行为的东西(我的笔记在连字符后面):

D/LifeCycle﹕ onStart - old activity - first activity started for the first time
...
D/LifeCycle﹕ starting new activity  - a button triggers starting the second activity
D/LifeCycle﹕ onStart - old activity - ??????
D/LifeCycle﹕ onStart - new activity - second activity is starting
D/LifeCycle﹕ onStop - old activity  - first activity is stopped
...
D/LifeCycle﹕ onStart - old activity - pressing the back button, returning to the first activity
D/LifeCycle﹕ onStop - old activity  - ??????
D/LifeCycle﹕ onStop - new activity  - second activity is stopped

这是我开始新活动的方式(我不必传递任何东西):

startActivity(new Intent(this, ResultListActivity.class));

此外,当我在标记函数的问题中调用findViewById时,我得到null。 任何人都可以解释为什么我得到这个日志?

顺便说一句,我正在模拟器上运行,但是当我在nexus 5上运行它时,它似乎表现得一样。

0 个答案:

没有答案