[英]How to clear cache in osmdroid?
The code below is not working. 以下代码无效。
mapView.getTileProvider().clearTileCache();
Is there another way to do it? 还有另一种方法吗?
I found a solution to my question. 我找到了解决问题的方法。 After going through the source in order to find out why the cache is not cleared after executing
在浏览源之后,找出执行后未清除缓存的原因
mapView.getTileProvider().clearTileCache();
i found two functions in: 我发现了两个功能:
org.osmdroid.tileprovider.modules.SqlTileWriter.java
Functions: 职能:
/* purges and deletes everything from the cache database */
public boolean purgeCache(){..}
and 和
/* purges and deletes all tiles from the given tile source name from the cache database */
public boolean purgeCache(String mTileSourceName){..}
Example to delete cache for specific tile source: 删除特定磁贴源的缓存的示例:
SqlTileWriter sqlTileWriter = new SqlTileWriter();
boolean isCleared = sqlTileWriter.purgeCache(mapView.getTileProvider().getTileSource().name());
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.