WAY1:如何避免ActivityRecord錯誤的Activity暫停超時?
@Override
protected void onPause() {
super.onPause();
// do something urgent
doSomething();
}
WAY2:
@Override
protected void onPause() {
// do something urgent
doSomething();
super.onPause();
}
所不同的是的doSomething()
和super.onPause()
呼叫序列。當我使用WAY1時,如果doSomething()
的成本太高,我會得到錯誤:W/ActivityManager(4347): Activity pause timeout for ActivityRecord
。
如果我使用WAY2,我會避免pause timeout
錯誤嗎?
我檢查了AOSP,但是我很難理解Activity的調用過程。
根據http://developer.android.com/intl/es/training/basics/activity-lifecycle/pausing.html您必須始終調用超類方法 – antonio
@antonio是的。我看到了。你知道原因嗎? –
http://stackoverflow.com/a/9626268/1320616和http://stackoverflow.com/a/18874519/1320616將正確解釋你需要知道的一切 –