简体   繁体   中英

Android - GoogleMap Clear Cache

I have designed one app, in that I am calling a Fragment which shows a map from FragmentActivity . But, when I retrun back to FragmentActivity from Fragment of Map it shows blackscreen. It loads the list after 20 to 30 seconds..

So, is there is any solution on this which will clear the map cache while returning to FragmentActivity from Fragment so that list on FragmentActivity will be displayed properly..?

Duplicate: Programmatically clearing map cache

TL;DR - No, you can't clear the GoogleMap cache as of API v2 yourself.

It's perfectly possible to delete Map Cache

Tiles are stored in your data directory

To see it, use File Explorer

在此处输入图片说明

Go in your application data folder to see it:

在此处输入图片说明

Programmatically, there is the way to clear it:

context.dataDir
    ?.listFiles()
    ?.first { it.name == "app_tilesFolder" }
    ?.deleteRecursively()

Change the name if the cache folder change in the future

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM