private void initMapSourcePreference() {

        // old map ---------------------------------------------------------------------------------
        final Collection<MapSource> mapSources = MapProviderFactory.getMapSources();
        final CharSequence[] entries = new CharSequence[mapSources.size()];
        final CharSequence[] values = new CharSequence[mapSources.size()];
        int idx = 0;
        for (MapSource mapSource : MapProviderFactory.getMapSources()) {
            entries[idx] = mapSource.getName();
            values[idx] = mapSource.getId();
            idx++;
        }
        prefMapSources.setEntries(entries);
        prefMapSources.setEntryValues(values);
        prefMapSources.setOnPreferenceChangeListener((preference, newValue) -> {
            final String newMapSource = (String) newValue;

            // reset the cached map source
            MapSource mapSource;
            try {
                mapSource = MapProviderFactory.getMapSource(newMapSource);
            } catch (final NumberFormatException e) {
                Log.e("PreferenceMapFragment.onMapSourcesChange: bad source id '" + newMapSource + "'", e);
                mapSource = null;
            }
            // If there is no corresponding map source (because some map sources were
            // removed from the device since) then use the first one available.
            if (mapSource == null) {
                mapSource = MapProviderFactory.getAnyMapSource();
                if (mapSource == null) {
                    // There are no map source. There is little we can do here, except log an error and
                    // return to avoid triggering a null pointer exception.
                    Log.e("PreferenceMapFragment.onMapSourcesChange: no map source available");
                    return true;
                }
            }
            Settings.setMapSource(mapSource);
            return true;
        });


        // UnifiedMap ------------------------------------------------------------------------------
        final HashMap<String, AbstractTileProvider> tileProviders = TileProviderFactory.getTileProviders();
        final CharSequence[] entriesUM = new CharSequence[tileProviders.size()];
        final CharSequence[] valuesUM = new CharSequence[tileProviders.size()];
        int idxUM = 0;
        for (AbstractTileProvider tileProvider : tileProviders.values()) {
            entriesUM[idxUM] = tileProvider.getTileProviderName();
            valuesUM[idxUM] = tileProvider.getId();
            idxUM++;
        }
        prefTileProvicers.setEntries(entriesUM);
        prefTileProvicers.setEntryValues(valuesUM);
        prefTileProvicers.setOnPreferenceChangeListener((preference, newValue) -> {
            final String newTileProvider = (String) newValue;

            // reset the cached map source
            AbstractTileProvider tileProvider;
            try {
                tileProvider = TileProviderFactory.getTileProvider(newTileProvider);
            } catch (final NumberFormatException e) {
                Log.e("PreferenceMapFragment.onMapSourcesChange: bad source id '" + newTileProvider + "'", e);
                tileProvider = null;
            }
            // If there is no corresponding map source (because some map sources were
            // removed from the device since) then use the first one available.
            if (tileProvider == null) {
                tileProvider = TileProviderFactory.getAnyTileProvider();
                if (tileProvider == null) {
                    // There are no map source. There is little we can do here, except log an error and
                    // return to avoid triggering a null pointer exception.
                    Log.e("PreferenceMapFragment.onMapSourcesChange: no map source available");
                    return true;
                }
            }
            Settings.setTileProvider(tileProvider);
            return true;
        });

    }
Fill the choice list for map sources.
main/src/main/java/cgeo/geocaching/settings/fragments/PreferenceMapSourcesFragment.java