Android Question Zip multiple files with ABZipUnzip

Hirogens

Active Member
Licensed User
Longtime User
Hello, how can I zip 3 files ? Because with ABZipUnzip I can zip 1 file :/
 

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

Hirogens

Active Member
Licensed User
Longtime User
I have some issue with ArchiverPlusZip librarie, when I try to create my zip file with 3 files in it I have this error
B4X:
writing descriptor: false
writing descriptor: false
page_activite_save_fatigue_click (java line: 1260)
a.a.a.c.a: java.io.FileNotFoundException: /storage/emulated/0/Android/data/rpcycling.appdev/files/GPS_Location: open failed: EISDIR (Is a directory)
    at a.a.a.a.c.a(SourceFile:430)
    at a.a.a.a.c.e(SourceFile:976)
    at a.a.a.a.c.a(SourceFile:262)
    at b4a.flm.archiverplus.ArchiverPlusZip.AddFilesToZip(SourceFile:304)
    at rpcycling.appdev.page_activite._save_fatigue_click(page_activite.java:1260)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:186)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:170)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:166)
    at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:80)
    at android.view.View.performClick(View.java:6256)
    at android.view.View$PerformClick.run(View.java:24697)
    at android.os.Handler.handleCallback(Handler.java:789)
    at android.os.Handler.dispatchMessage(Handler.java:98)
    at android.os.Looper.loop(Looper.java:164)
    at android.app.ActivityThread.main(ActivityThread.java:6541)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Caused by: java.io.FileNotFoundException: /storage/emulated/0/Android/data/rpcycling.appdev/files/GPS_Location: open failed: EISDIR (Is a directory)
    at libcore.io.IoBridge.open(IoBridge.java:512)
    at java.io.RandomAccessFile.<init>(RandomAccessFile.java:255)
    at a.a.a.a.c.a(SourceFile:419)
    ... 18 more
Caused by: android.system.ErrnoException: open failed: EISDIR (Is a directory)
    at libcore.io.IoBridge.open(IoBridge.java:502)
    ... 20 more
Any ideas ?

Edit: my line is : myZip.AddFilesToZip(files_to_zip, shared, "ZipResult")
shared is equal to shared = Starter.rp.GetSafeDirDefaultExternal("GPS_Location")
 
Upvote 0

npsonic

Active Member
Licensed User
You don't have to use libraries created by others. It just makes you depended of those developers and you have to trust that those developers maintain there libs in future too.

Here's example for you. Let's call it ZipManager. Now you can always edit the class and mod it how you like.

Example of use:
B4X:
Dim zm As ZipManager
zm.Initialize

zm.Zip(Array As String(File.Combine(File.DirInternal,"image1.png"),File.Combine(File.DirInternal,"image2.png")),File.Combine(File.DirInternal,"myimages.zip"))
If zm.UnZip(File.Combine(File.DirInternal,"myimages.zip"),File.Combine(File.DirInternal,"unzipped")) Then
    Log("success")
Else
    Log("failed")
End If

Wait For (zm.ZipAsync(Array As String(File.Combine(File.DirInternal,"image1.png"),File.Combine(File.DirInternal,"image2.png")),File.Combine(File.DirInternal,"myimages.zip"))) Complete(Success As Boolean)
Log("zip success " & Success)
If Success Then
    Wait For (zm.UnZipAsync(File.Combine(File.DirInternal,"myimages.zip"),File.Combine(File.DirInternal,"images"))) Complete(Success As Boolean)
    Log("unzip success " & Success)
End If
 

Attachments

  • ZipManager.bas
    3.6 KB · Views: 485
Last edited:
Upvote 0
Top