I am having trouble replacing a fragment from the onLoadFinished() method of my 
loader. I have posted the problem to StackOverflow here 
<http://stackoverflow.com/questions/38685437/listviews-performitemclick-causes-illegalstateexception-when-called-inside-on>.
 

When I checked the source code for LoaderManager, I found that the following 
code sets the variable mNoTransactionsBecause to "onLoadFinished".


I know it's related to Android framework's internal design but can anyone shed 
some light on the rationale behind blocking fragment transactions

in this way?



void callOnLoadFinished(Loader<Object> loader, Object data) {
    if (mCallbacks != null) {
        String lastBecause = null;
        if (mActivity != null) {
            lastBecause = mActivity.mFragments.mNoTransactionsBecause;
            mActivity.mFragments.mNoTransactionsBecause = "onLoadFinished";
        }
        try {
            if (DEBUG) Log.v(TAG, "  onLoadFinished in " + loader + ": "
                    + loader.dataToString(data));
            mCallbacks.onLoadFinished(loader, data);
        } finally {
            if (mActivity != null) {
                mActivity.mFragments.mNoTransactionsBecause = lastBecause;
            }
        }
        mDeliveredData = true;
    }
}

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/04976ab1-a0f9-4635-973a-9696466e2fbd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to