Open jmwohl opened 10 years ago
The apache commons library for java[1] has a single function called deleteDirectory()[2] you could use.
I'm not sure if apache commons can be loaded and used as a library within android, though.
[1] http://commons.apache.org/ [2] http://commons.apache.org/proper/commons-io/apidocs/org/apache/commons/io/FileUtils.html#deleteDirectory%28java.io.File%29
Yeah, I actually added that yesterday! It's in the refactor branch — it works fine, but takes about the same amount of time which makes me think it's also recursive? Haven't tried to find the source. But I have it running on a separate thread with some UI feedback now, which is better... could still use some clean up.
EDIT: I looked up the Apache source code just to make sure, and indeed the commons io deleteDirectory() method is recursive as well — I'm going to stick with using that lib anyway though, since it's certainly well tested.
On Android, deleting the existing tiles runs on the UI thread, which blocks the UI until complete.
Thoughts: