Search code examples
javaandroidsd-cardunzip

Cant unzip file, tested different functions


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


Solution

  • 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();