Code example for LruCache

Methods: remove

0
 
        // Do we already have this fragment? 
        String name = makeFragmentName(container.getId(), position);
 
        // Remove item from the cache 
        mFragmentCache.remove(name);
 
        Fragment fragment = mFragmentManager.findFragmentByTag(name);
        if (fragment != null) {
            if (DEBUG) Log.v(TAG, "Attaching item #" + position + ": f=" + fragment);
            mCurTransaction.attach(fragment);
        } else { 
            fragment = getItem(position);
            if (DEBUG) Log.v(TAG, "Adding item #" + position + ": f=" + fragment);
            mCurTransaction.add(container.getId(), fragment,
                    makeFragmentName(container.getId(), position));
        } 
        if (fragment != mCurrentPrimaryItem) {
            fragment.setMenuVisibility(false);
        }