2015-05-12 75 views

回答

3

Here是可能的實現之一。

類的簽名如下所示:

final class BackStackRecord extends FragmentTransaction implements FragmentManager.BackStackEntry, Runnable {...} 

在grep的代碼,你可以點擊小箭頭指向下方旁邊的類名找到派生類。

只是爲了讓這個答案完整:

int commitInternal(boolean allowStateLoss) { 
    if (mCommitted) { 
     throw new IllegalStateException("commit already called"); 
    } 
    if (FragmentManagerImpl.DEBUG) { 
     Log.v(TAG, "Commit: " + this); 
     LogWriter logw = new LogWriter(Log.VERBOSE, TAG); 
     PrintWriter pw = new FastPrintWriter(logw, false, 1024); 
     dump(" ", null, pw, null); 
     pw.flush(); 
    } 
    mCommitted = true; 
    if (mAddToBackStack) { 
     mIndex = mManager.allocBackStackIndex(this); 
    } else { 
     mIndex = -1; 
    } 
    mManager.enqueueAction(this, allowStateLoss); 
    return mIndex; 
} 

commitInternalcommit

+0

我不知道爲什麼我正在尋找類似的東西叫'FragmentTransactionImpl'.Thank你! – Droidekas

相關問題