I'm loading tiles from asstets, these is my code, which initialize map:
mapView = (MapView)findViewById(R.id.offline_map_view);
mapView.setClickable(true);
mapView.setBuiltInZoomControls(false);
mapView.setMaxZoomLevel(macroZoomLevel);
mapView.setMinZoomLevel(macroZoomLevel);
mapView.getController().setZoom(macroZoomLevel); //set initial zoom-level, depends on your need
mapView.setTileSource(new XYTileSource("MapQuest", 0, 18, 256, ".png",new String[] {"file:///android_asset/try/"} ));
mapView.setUseDataConnection(false); //keeps the mapView from loading online tiles usi1ng network connection.
mapView.getController().setCenter(new GeoPoint(54.370958, 18.589210));
giveMarkersForActualLevel();
and everything is ok till I try to zoom in, there are part of maps which not rendering properly. Then I zoom out and then area which was on the beginning rendered properly is now having some gray tiles.
Firstly, I used osmdroid 4.3, added in this way:
compile 'org.osmdroid:osmdroid-android:4.3'
Then I try with newest version of osmdroid, importing it by method which is described on the website compile 'org.osmdroid:osmdroid-android:5.1@aar'
Then I read here tu build from sources so I download newest sources, build it by gradle and added aar
file osmdroid-android-release.aar
.
This doesn't fix my issue, too.
After zoom in and zoom out, I'm removing markers and adding another ones, so I tried to refresh map in this way.
((View)mapView.getParent()).invalidate();
mapView.invalidate();
mapView.postInvalidate();
Marker startMarker = new Marker(mapView);
startMarker.setPosition(new GeoPoint(54.337385, 18.662132));
setPropertiesForTopMarker(startMarker);
mapView.getOverlays().add(startMarker);
Marker startMarker1 = new Marker(mapView);
startMarker1.setPosition(new GeoPoint(54.332781, 18.587932));
setPropertiesForTopMarker(startMarker1);
mapView.getOverlays().add(startMarker1);
mapView.invalidate();
((View)mapView.getParent()).invalidate();
mapView.invalidate();
mapView.postInvalidate();
but it doesn't work too.
Have you got any ideas, how this issue can be resolved?
EDITED:
I tried to build osmdroid from sources to change this values mentioned by @spy. The debug from my logcat looks ok. Here are logs. I can't paste it here, because there are too many lines.
I tried with adding tiles providers in this way:
final IRegisterReceiver registerReceiver = new SimpleRegisterReceiver(getApplicationContext());
final ITileSource tileSource = new XYTileSource("MapQuest", 12, 14, 256, ".png",new String[] {"file:///android_asset/MapQuest/"} );
final MapTileFilesystemProvider fileSystemProvider = new MapTileFilesystemProvider(
registerReceiver, tileSource);
final MapTileProviderArray tileProviderArray = new MapTileProviderArray(
tileSource, registerReceiver, new MapTileModuleProviderBase[] {
fileSystemProvider});
mapView = new MapView(this, new DefaultResourceProxyImpl(this), tileProviderArray);
or this way
final IRegisterReceiver registerReceiver = new SimpleRegisterReceiver(getApplicationContext());
final ITileSource tileSource = new XYTileSource("MapQuest", 12, 14, 256, ".png",new String[] {"file:///android_asset/MapQuest/"} );
final MapTileFilesystemProvider fileSystemProvider = new MapTileFilesystemProvider(
registerReceiver, tileSource);
final MapTileProviderArray tileProviderArray = new MapTileProviderArray(
tileSource, registerReceiver, new MapTileModuleProviderBase[] {
fileSystemProvider});
TilesOverlay tilesOverlay =
new TilesOverlay(tileProviderArray, getApplicationContext());
mapView.getOverlays().add(tilesOverlay);
but both methods didn't show me any map. Source of this code.