Mapsforge .map file are not shown on the osmdroid mapview

226 Views Asked by At

I'm building an application to display the mapsforge .map file on the osmdroid mapview offline that should read the file from the phone memory sdcard and show on the map. I used the following code for this purpose but nothing is displayed. please guide me. Thanks

String path = "/sdcard"+PATH_BASE_OSMDROID_MAP_FILE+"/";
                    File folder = new File(path);
                    File[] listOfFiles = folder.listFiles();
                    if (listOfFiles == null)
                        return false;
    /*
        File mapFile = null;
        for (File file:listOfFiles){
            if (file.isFile() && file.getName().endsWith(".map")){
                mapFile = file;
            }
        }
        if (mapFile == null)
            return false;
        //TODO: build a list with only .map files; get rendering config file if any.
        */
                    if (AndroidGraphicFactory.INSTANCE == null)
                        AndroidGraphicFactory.createInstance(getApplication());
                    MapsForgeTileProvider mfProvider = new MapsForgeTileProvider(
                            new SimpleRegisterReceiver(
                                    getBaseContext()),
                            MapsForgeTileSource.createFromFiles(listOfFiles));

                    MapTileProviderBase mapTileProviderBase = new MapsForgeTileProvider(
                            new SimpleRegisterReceiver(
                                    getBaseContext()),
                            MapsForgeTileSource.createFromFiles(listOfFiles));

                    Log.d("MAPSFORG",listOfFiles[0].getName()
                            +mfProvider.getTileSource().name());
                    MapsForgeTileSource mapsForgeTileSource =
                    MapsForgeTileSource.createFromFiles(listOfFiles);
                    ITileSource iTileSource = mapsForgeTileSource;
                    map.setTileSource(mapsForgeTileSource);
0

There are 0 best solutions below