I have a problem using the osmdroid
when I use this code
map.setTileSource(TileSourceFactory.MAPQUESTOSM);
I have no problem using the online map. But this does not allow me to use the offline map from sd.
As such, I changed to
map.setTileSource(new XYTileSource("MapQuest", 0, 18, 256, ".jpg", new String[]{}));
This allows me to load the offline map, but I cannot receive online map at the same time,
I get this error:
Error downloading MapTile: /18/130173/86895
java.lang.IllegalArgumentException: n <= 0: 0
at java.util.Random.nextInt(Random.java:182)
at org.osmdroid.tileprovider.tilesource.OnlineTileSourceBase.getBaseUrl(OnlineTileSourceBase.java:33)
at org.osmdroid.tileprovider.tilesource.XYTileSource.getTileURLString(XYTileSource.java:19)
at org.osmdroid.tileprovider.modules.MapTileDownloader$TileLoader.loadTile(MapTileDownloader.java:178)
at org.osmdroid.tileprovider.modules.MapTileModuleProviderBase$TileLoader.run(MapTileModuleProviderBase.java:291)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
I am sure I have permission for the internet, may I know how can I use online and offline map at the same time is osmdroid?
I solved my problem by changing to this line.
map.setTileSource(new XYTileSource("MapQuest", 0, 18, 256, ".jpg", new String[] { "http://otile1.mqcdn.com/tiles/1.0.0/map/", "http://otile2.mqcdn.com/tiles/1.0.0/map/"}));
Hope it helps other people who has the same problem