B4A Library SD: ZipLibrary

SD_ZipLibray

Author:
Star-Dust
Version: 1.03
  • SD_ZipLibrary
    • Event
      • finish (Success as Boolean)
    • Functions:
      • Class_Globals As String
      • Initialize (CallBack As Object, EventName As String) As String
        Initializes the object. You can add parameters to this method if needed.
      • IsInitialized As Boolean
        Verifica se l'oggetto sia stato inizializzato.
      • unZip (FileZip As String, OutPutFolder As String) As String
      • unZipList (FileZip As String) As List
      • Zip (FilesTxt As String(), FileZip As String) As String

SD_ZipLibray

Author:
Star-Dust
Version: 1.03
  • SD_ZipLibrary
    • Event
      • finish (Success as Boolean)
    • Functions:
      • Class_Globals As String
      • Initialize (CallBack As Object, EventName As String) As String
        Initializes the object. You can add parameters to this method if needed.
      • IsInitialized As Boolean
        Verifica se l'oggetto sia stato inizializzato.
      • unZip (FileZip As String, OutPutFolder As String) As String
      • unZipList (FileZip As String) As List
      • Zip (FilesTxt As String(), FileZip As String) As String

List file in to Zip
B4X:
Dim UZ As SD_ZipLibrary

    UZ.Initialize
    Log("File: " & File.Exists(File.DirRootExternal,fileZipName))
    Dim L As List = UZ.unZipList(File.Combine(File.DirRootExternal,fileZipName))

Unzip
B4X:
Dim UZ As SD_ZipLibrary

UZ.Initialize
    UZ.unZip(File.Combine(File.DirRootExternal,fileZipName),File.Combine(File.DirRootExternal,DestinationPath))


Zip files
B4X:
Dim ZL As SD_ZipLibray
Dim ListFiles as List

ZL.Initialize(Me,"ZL")
ZL.Zip(ListFiles,ZipFileName)

Wait For
B4X:
Dim UZ As SD_ZipLibrary

UZ.Initialize
Log("File: " & File.Exists(File.DirRootExternal,fileZipName))
Dim L As List = UZ.unZipList(File.Combine(File.DirRootExternal,fileZipName))

Wait For UZ_finish(Success As Boolean)
Log("result:" &Success)
Log("Num: " & L.Size)
 

Attachments

  • SD_ZipLibray 0.13.zip
    3.9 KB · Views: 981
  • SD_ZipLibrary.bas
    4.8 KB · Views: 739
Last edited:

lelelor

Member
Licensed User
Hi lelelor

Welcome. We all have to learn a new language we have to survive in this ever changing world.
That said, since you are learning the language and Android logic, which Google keeps on changing all time, making experience users pull their hairs, forget about learners.

Now for your problem, I will suggest go step by step.
If you are using old version of Android like 5 or 6, then many things will work easy as Android was less restrictive and more open then.
If you are using newer version of Android like 10 or 11, then many things will not work easy as Android is more restrictive now.

Please give your Android details here and we may be able to give better solution.

Keep in mind if you are afraid to fall down, you will never learn to walk. Look at the baby he/she is never afraid to fall but looks for support.
Members here are more supportive and helpful and we will not let you fall. That's all I can say.
thanks for your availability, I use sunmi handhelds with Android 7.12
I have been using VB6 microsoft for a long time and it is on the same wave as b4a, I believe that the .zip file is generated and I would like to "only" see it in a path, such as "dirinternal" of the application itself, then copy it to a network devices I know how to do it.
 

AnandGupta

Expert
Licensed User
Longtime User
sunmi handhelds with Android 7.12
So Android 7, Ok

What is output of ilan's code ?
B4X:
       Log($"File exists: ${File.Exists(File.DirInternal, "leleolor.zip")}"$)
See if zip file name is correct in code.
 

lelelor

Member
Licensed User
all is ok now.

One last question: when i decomrpess the zip file on my windows desktop i get the full path:

"\data\user\0\mbsoft.mblive\files\MBLive_06_Novembre_2018.txt"

is there an option to zip a file without the full path? i only need "MBLive_06_Novembre_2018.txt"
hello, were you able to compress only the file without path? Thanks
 

Star-Dust

Expert
Licensed User
Longtime User
I don't remember it's been too long. There is the source code, you can see for yourself
 
Top