Please, in the international forum, write in English
B4X:
Dim Zip As SD_ZipLibrary
Dim ZipFileDirectory As String = XUI.DefaultFolder
Dim MyFileName As String = File.Combine(OriginalPath,"myfiles.txt")
Zip.Initialize
Zip.Zip(array as string(MyFileName), File.Combine(ZipFileDirectory,"myfilecompress.zip"))
Wait For UZ_finish(Success As Boolean)
Log("result:" &Success)
Log("Num: " & L.Size)
You have to take into account that now with the latest Android versions you can't access DirRootExternal easily. So if the original file to be compressed is external you have to use ContentChooser
And the compressed file must be saved internally. (e.g. XUI.DefaultFolder). If you need to copy it externally or pass it to some other app you have to see the latest instructions on this
B4A + B4i example: https://www.b4x.com/android/forum/threads/b4x-texteditor-save-and-load-external-files.132731/#post-838166 List of classes or libraries that can be used to access secondary storages: ContentChooser (Phone libray) - allows the user to select a resource or file using external...
www.b4x.com
Hello, I am attaching the button I use to create the .zip file, from the example I do not understand what UZ.finish is
basically I can't find the .zip file, it's not created
</>
Sub BTZip_click
Dim giorno As String
Dim sf As StringFunctions2
Dim aaaa As String
Dim gg As String
Dim mm As String
Dim oraminutisecondi As String
Dim adesso As String
Dim hh As String
Dim mn As String
Dim ss As String
Dim Zip As SD_ZipLibrary
Dim ZipFileDirectory As String = xui.DefaultFolder
'Dim ZL As SD_ZipLibrary
Dim myfilename As String = File.Combine(File.DirInternal,"/anaiper/anaiperC.txt")
Dim zipfilename As String
'Log("fileinternal " & File.dirinternal)
giorno=sf.Today
mm=giorno.substring2(0,2)
gg=giorno.substring2(3,5)
aaaa=giorno.SubString2(6,10)
adesso=DateTime.Now
oraminutisecondi = DateTime.Time(adesso)
hh=oraminutisecondi.SubString2(0,2)
mn=oraminutisecondi.SubString2(3,5)
ss=oraminutisecondi.SubString(6)
'Log ("anno " & aaaa)
'Log("giorno " & gg)
'Log("mese " & mm)
'Log(oraminutisecondi)
'Log("ora "& hh)
'Log("minuti " & mn)
'Log("secondi " & ss)
'Zip.Initialize
' Wait For UZ_finish(Success As Boolean)
' Log("result:" &Success)
' Log("Num: " & L.Size)
zipfilename="rileva"& aaaa & mm & gg & hh & mn & ss & "_" & gg &"-" & mm & "-" & aaaa & "-" & hh & "." & mn & "." & ss & "_SC_.zip "
Log("zipfilename " & zipfilename)
Log("zipfiledirectory " & ZipFileDirectory)
Log("MYFILENAME " & myfilename)
Zip.Initialize (Me,"Zip")
' ZL.Zip(Array As String(myfilename), File.Combine(ZipFileDirectory,"myfilecompress.zip"))
Zip.Zip(Array As String(myfilename), File.Combine(ZipFileDirectory,"rileva"& aaaa & mm & gg & hh & mn & ss & "_" & gg &"-" & mm & "-" & aaaa & "-" & hh & "." & mn & "." & ss & "_SC_.zip "))
' Zip.Zip(myfilename, File.Combine(ZipFileDirectory,zipfilename))
'Zip.Zip(Array As String(myfilename), File.Combine(ZipFileDirectory,"myfilecompress.zip"))
Wait For UZ_finish(Success As Boolean)
Log("result:" & Success)
' Log(Zip.Zip)
'Log("Num: " & Zip.Zip )
Log("fatto?")
End Sub
</>