How to create a normal password-protected ZIP archive?

前端 未结 2 1850
闹比i
闹比i 2020-12-16 02:02

My app zips several files, saves the zip file to the SD card, and it emails the zip file to an address.

The zipping is done with this code: Zipping Files with Androi

2条回答
  •  天涯浪人
    2020-12-16 02:18

    I've searched a lot and finally found a good library that can zip files with password easily:

    Zip:

    ZipArchive zipArchive = new ZipArchive();
    zipArchive.zip(targetPath,destinationPath,password);
    

    Unzip:

    ZipArchive zipArchive = new ZipArchive();
    zipArchive.unzip(targetPath,destinationPath,password);
    

    Rar:

    RarArchive rarArchive = new RarArchive();
    rarArchive.extractArchive(file archive, file destination);
    

    The documentation of this library is good enough, I just added a few examples from there. It's totally free and wrote specially for android.

提交回复
热议问题