1

I am unable to unzip file on sdcard. I have tested http://www.jondev.net/articles/Unzipping_Files_with_Android_%28Programmatically%29 How to unzip files programmatically in Android? Android - Unzip a folder?

It shows no error, no warning, nothing, like everything is okay. But zip file is not extracted.

I have WRITE_EXTERNAL_STORAGE_PERMISSION enabled, so I can write to sdcard from app (it works, I tested that)

What can it be?

Thanks

Community
  • 1
  • 1
POMATu
  • 3,422
  • 7
  • 30
  • 42

1 Answers1

0

Try using zip4j library

With the solution by jondev you must pay attention to file paths: a single / omitted could cause nothing works

EDIT: Based on comments, probably this can help you:

String externalPath = getExternalFilesDir(null).getAbsolutePath();
Decompress d = new Decompress(externalPath + "/test.zip", externalPath + "/");
d.unzip();
Vito Gentile
  • 13,336
  • 9
  • 61
  • 96
  • `Decompress d = new Decompress("/sdcard/test.zip", "/sdcard/app/"); d.unzip(); ` – POMATu Nov 16 '11 at 19:14
  • See edit in my answer. I suppose the file test.zip is in the root directory of external storage – Vito Gentile Nov 16 '11 at 20:39
  • Thanks, I'll try, but I am a bit skeptic now, because I think that `getExternalFilesDir(null).getAbsolutePath()` means `"/sdcard"` – POMATu Nov 16 '11 at 21:20
  • Mmmh... Did you test every stuff mentioned here ---> http://developer.android.com/guide/topics/data/data-storage.html#filesExternal ? – Vito Gentile Nov 16 '11 at 21:53