Have an amazing solution built in RAD Studio? Let us know. Looking for discounts? Visit our Special Offers page!
C++DelphiTech Partner

Secrets to Quickly and Efficiently Handle Zip Files on Android with Delphi, C++ Builder, and FireMonkey

Use the Zip4j library for zip files or streams in Delphi and C++ Builder to fully handle zip files in your FireMonkey project easily. Zip4j has several major features for instance: Zip encryption, Support for Zip64 format, support for streams, support for both AES and Zip-Standard encryption methods, and many more.

To utilize this Zip4j library in your Delphi and C++ Builder FireMonkey projects you can use Zip for Android library from WINSOFT. This is a commercial library that has a trial version with all features for evaluation only and if you wish to distribute Zip for Android library as part of your Android application, you must register a license.

You should know that you can utilize this Zip4j library directly by creating a module yourself to call its functions from your Delphi code. But the Zip for Android library has already implemented all the needed modules to you. It means in a little amount of time you can utilize Zip4j functionalities without creating modules.

With this Zip for Android library, you can create, add, extract, update, and remove files from a Zip file with Zip Parameters. Moreover, you can get zip file header data easily to learn Zip file configurations.

Let’s investigate the features of the Zip for Android library. The first step is to install the library itself into your IDE. Here is the short tutorial on installing the library. 

The next step is to add the zip4j-2.5.3-SNAPSHOT.jar file into your Android 32-bit library list by add option here:

Add Library



User interface:

So, you can watch this short video showing the demo in action or you can just follow this article and learn the main features and use cases of the Zip for Android library. 

Here are our helper functions:

  • FileName function gets the Full Path of the file
  • FileContent function returns string data
  • ZippedFileName function returns the zipped file path

To utilize Zip for Android library we should add Winsoft.Android.Zip unit to uses section with other units:

Now, we can discover how this library is creating Zip files.

As you can see this is what we need to create Zip files. With the help of a JZipFile instance (ZipFile) we can create Zip files and set Zip parameters like compression method & level, and encryption method. Furthermore, we may encrypt files with a password.

Now, learn how to list files in the zip archive here.

  • JZipFile & JFileHeader are the main instances in this process.

In this function, we are opening a zip file by creating an instance of JZipFile. Then it gets file header data like compressed size and after that, it is printing header data on TMemo component.
Finally, we should see how to extract zip files. We just need a JZipFile instance to open zip files and extract them. You can utilize the extractAll function.

Great! We have learned the essential features of the Zip for Android library.

Like what you see? You can get Zip for Android and over 100 other fantastic WinSoft components with our Enterprise Component Pack. For a limited time, when you purchase RAD Studio Enterprise or Architect Edition at special Upgrade Pricing, you will also get this package of third-party software worth over $13,000, including the full WinSoft Component Library, at NO EXTRA COST! Step up to RAD Studio 10.4 today!

DelphiCon 2021

Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial   Upgrade Today

   Free Delphi Community Edition   Free C++Builder Community Edition

About author

Software Developer | B.Tech-CSE at AUT | Delphi/C++ Builder Enthusiast | Microsoft Learn Student Ambassador | Microsoft Azure Certified | Udacity Alumni
Related posts

Gain A Python Performance Revolution With Delphi


Get To Know This Industry-Leading Mobile Lighting Delphi App


What Are C++ Live Data Bindings, Charts And Vectors?

DelphiRAD Studio

The Inexorable Rise Of The Supercharged Developer

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.