1、res 目录下 创建 raw 文件夹
2、将 BaiduMapSDKNew\vmp 压缩成 map.zip 放到 raw 文件夹,不需要cache目录 压缩 BaiduMapSDKNew 文件夹
3、点击按钮或其它方式 将map.zip 解压到 files 目录
下面是解压代码
private void unZipMapCache(){
try {
InputStream is = fragmentActivity.getResources()
.openRawResource(R.raw.map);
ZipInputStream zis= new ZipInputStream(is);
ZipEntry entry = null;
while((entry = zis.getNextEntry()) != null){
File file = new File(fragmentActivity.getExternalFilesDir(null),entry.getName());
System.out.println("filename----"+entry.getName());
if(entry.isDirectory()){
file.mkdirs();
continue;
}else{
file.createNewFile();
OutputStream myOutput = new FileOutputStream(file);
byte[] buffer = new byte[1024];
int count;
while ((count = zis.read(buffer)) != -1) {
myOutput.write(buffer, 0, count);
}
myOutput.close();
}
}
zis.close();
is.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}