try{
File f = new File("/data/cizip.zip");
if(f.exists()){
ZipFile zf = new ZipFile(f); //this alway开发者_如何学Cs throws an error
/*some of my codes here*/
}
catch(IOException e){
AlertDialog.Builder abd = new AlertDialog.Builder(this);
abd.setMessage(e.getMessage());
abd.show();
}
the line ZipFile zf = new ZipFile(f);
always throws an error and I don't know why. And the error message is the file name ("/data/cizip.zip"), therefore I can't know the cause of the error. Can someone please tell me what causes this error? Thanks in advance.
This is just a guess, but maybe the file is in use (locked)? I don't see anything obviously wrong with your code...
Your app doesn't have read/write permissions directly in the /data/ directory. You should use either the correct subfolder "/data/data/your.program.package/" or just the "/sdcard/"
精彩评论