When should super.onResume() be called?

后端 未结 3 853
孤城傲影
孤城傲影 2020-12-29 22:43

When should super.onResume(); be called, on the first line of onResume() or on the last line?

protected void onResume() {
    Log.i         


        
3条回答
  •  粉色の甜心
    2020-12-29 23:05

    Android’s source code can tell us everything. If you check the Activity super class you can find the following lines:

    protected void onResume() {
        if (DEBUG_LIFECYCLE) Slog.v(TAG, "onResume " + this);
        getApplication().dispatchActivityResumed(this);
        mCalled = true;
    }
    

    On this basis, no matter before or after it is called.

提交回复
热议问题