private void switchListById(final int id, @NonNull final AfterLoadAction action) {
        if (id < 0) {
            return;
        }

        final CacheListType previousListType = type;

        if (id != listId) {
            //reset load limit
            offlineListLoadLimit = getOfflineListInitialLoadLimit();
        }

        if (id == PseudoList.HISTORY_LIST.id) {
            type = CacheListType.HISTORY;
            if (previousListType != type) {
                currentCacheFilter = new GeocacheFilterContext(type.filterContextType);
            }
            restartCacheLoader(false, e -> e.putSerializable(BUNDLE_ACTION_KEY, action));
        } else {
            if (id == PseudoList.ALL_LIST.id) {
                listId = id;
                title = res.getString(R.string.list_all_lists);
                markerId = EmojiUtils.NO_EMOJI;
                preventAskForDeletion = true;
            } else {
                final StoredList list = DataStore.getList(id);
                listId = list.id;
                title = list.title;
                markerId = list.markerId;
                preventAskForDeletion = list.preventAskForDeletion;
            }
            type = CacheListType.OFFLINE;

            if (previousListType != type) {
                currentCacheFilter = new GeocacheFilterContext(type.filterContextType);
            }
            restartCacheLoader(false, e -> {
                e.putSerializable(BUNDLE_ACTION_KEY, action);
                e.putAll(OfflineGeocacheListLoader.getBundleForList(listId));
            });

            Settings.setLastDisplayedList(listId);
        }

        sortContext = GeocacheSortContext.getFor(type, "" + listId);

        initAdapter();
        setFilter();
        showProgress(true);
        refreshListFooter();
        adapter.setSelectMode(false);
        invalidateOptionsMenuCompatible();
    }
Extract a cache from adapter data.

@param adapterInfo an adapterInfo
@return the pointed cache
main/src/main/java/cgeo/geocaching/CacheListActivity.java