@Override
    public void onCreate(final Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setTheme();

        this.contentStorageActivityHelper = new ContentStorageActivityHelper(this, savedInstanceState == null ? null : savedInstanceState.getBundle(STATE_CONTENT_STORAGE_ACTIVITY_HELPER))
                .addSelectActionCallback(ContentStorageActivityHelper.SelectAction.SELECT_FILE_MULTIPLE, List.class, this::importGpx);

        // get parameters
        final Bundle extras = getIntent().getExtras();
        typeParameters.clear();
        Geopoint extraTargetCoords = null;
        if (extras != null) {
            typeParameters.putAll(extras);
            type = Intents.getListType(getIntent());
            coords = extras.getParcelable(Intents.EXTRA_COORDS);
            extraTargetCoords = extras.getParcelable(Intents.EXTRA_COORDS);
        }
        if (isInvokedFromAttachment()) {
            type = CacheListType.OFFLINE;
            if (coords == null) {
                coords = Geopoint.ZERO;
            }
        }
        if (type == CacheListType.NEAREST) {
            coords = LocationDataProvider.getInstance().currentGeo().getCoords();
        }

        setTitle(title);
        HideActionBarUtils.setContentView(this, R.layout.cacheslist_activity, false);

        // Check whether we're recreating a previously destroyed instance
        if (savedInstanceState != null) {
            // Restore value of members from saved state
            currentCacheFilter = savedInstanceState.getParcelable(STATE_GEOCACHE_FILTER);
            sortContext = savedInstanceState.getParcelable(STATE_SORT_CONTEXT);
            type = CacheListType.values()[savedInstanceState.getInt(STATE_LIST_TYPE, type.ordinal())];
            typeParameters.clear();
            typeParameters.putAll(savedInstanceState.getBundle(STATE_TYPE_PARAMETERS));
            listId = savedInstanceState.getInt(STATE_LIST_ID);
            markerId = savedInstanceState.getInt(STATE_MARKER_ID);
            preventAskForDeletion = savedInstanceState.getBoolean(STATE_PREVENTASKFORDELETION);
            offlineListLoadLimit = savedInstanceState.getInt(STATE_OFFLINELISTLOADLIMIT_ID);
            checkForEmtpyList = savedInstanceState.getBoolean(STATE_CHECKFOREMPTYLIST);
        } else {
            sortContext = GeocacheSortContext.getFor(type, "" + listId);
            sortContext.getSort().setTargetCoords(extraTargetCoords);
            offlineListLoadLimit = getOfflineListInitialLoadLimit();
            currentCacheFilter = new GeocacheFilterContext(type.filterContextType);
            checkForEmtpyList = true;
        }

        initAdapter();

        FilterUtils.initializeFilterBar(this, this);
        updateFilterBar();

        restartCacheLoader(false, null);
        refreshListFooter();

        if (isInvokedFromAttachment()) {
            if (extras != null && !StringUtils.isBlank(extras.getString(Intents.EXTRA_NAME))) {
                listNameMemento.rememberTerm(extras.getString(Intents.EXTRA_NAME));
            } else {
                final String data = ContentStorage.get().getName(getIntent().getData());
                listNameMemento.rememberTerm(StringUtils.isNotBlank(data) && StringUtils.endsWith(data.toLowerCase(Locale.ROOT), ".gpx") ? StringUtils.substring(data, 0, -4) : data);
            }
            importGpxAttachement();
        }

        getLifecycle().addObserver(new GeocacheChangedBroadcastReceiver(this) {
            @Override
            protected void onReceive(final Context context, final String geocode) {
                if (IterableUtils.matchesAny(adapter.getFilteredList(), geocache -> geocache.getGeocode().equals(geocode))) {
                    final Geocache geocache = DataStore.loadCache(geocode, EnumSet.of(LoadFlags.LoadFlag.DB_MINIMAL));
                    if (geocache != null) {
                        adapter.setElement(geocache);
                    }
                }
            }
        });
    }
TODO Possibly parts should be a Thread not a Handler
main/src/main/java/cgeo/geocaching/CacheListActivity.java