OK, I am using Informatix ArchivePlusZip library and I'm getting this weird error:
Here's my code, what am I doing wrong?
As you can see the error message is in the log AFTER the "ZipDone" log message line, which suggests the error happens AFTER the ZIP operation has completed.
But when I check the ZIP file, it did properly "create" the zip file and it did have the folder of "Events" in it, but it did NOT properly place any files in that folder.
But If I remove the two MsgBoxAsync lines from the sub, the ZIP file will be created correctly including the files being placed in the Events folder inside the ZIP.
So, another question I have is how can an error that seems to occur AFTER the ZIP operation is complete effect whats in the zip file? If I had to take a guess, it seems the "Wait For" event is triggering BEFORE the zip operation has actually completed and because this is a resumable sub (due to "Wait For" being in it) and events are not firing when they should, things are getting messed up.
You will notice that I am setting the Zip execution mode to Async mode because this was suggested by the lib maker because when I left it set to the default "Sync" mode, it would not work with the Wait For statement at all.
B4X:
ZipDone
main$ResumableSub_DebugFiles_Clickresume (java line: 557)
java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
at android.os.Handler.<init>(Handler.java:200)
at android.os.Handler.<init>(Handler.java:114)
at android.app.Dialog.<init>(Dialog.java:113)
at android.app.AlertDialog.<init>(AlertDialog.java:125)
at android.app.AlertDialog$Builder.create(AlertDialog.java:968)
at anywheresoftware.b4a.keywords.Common.createMsgboxAlertDialog(Common.java:520)
at anywheresoftware.b4a.keywords.Common.Msgbox2Async(Common.java:487)
at anywheresoftware.b4a.keywords.Common.MsgboxAsync(Common.java:466)
at com.omnisoft.handwash.main$ResumableSub_DebugFiles_Click.resume(main.java:557)
at anywheresoftware.b4a.BA.checkAndRunWaitForEvent(BA.java:250)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:190)
at a.a.a.f.a.a(SourceFile:88)
at a.a.a.f.a.c(SourceFile:155)
at a.a.a.f.a.a(SourceFile:163)
at a.a.a.h.a.a(SourceFile:227)
at a.a.a.i.a.a(SourceFile:12381)
at a.a.a.i.a$1.run(SourceFile:1101)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
** Activity (main) Pause, UserClosed = true **
Here's my code, what am I doing wrong?
B4X:
Sub DebugFiles_Click
Dim Zip As ArchiverPlusZip '1.13
'Below are the values of the input folder path and output file path
'AddFolder = /data/data/com.company.appname/files/Events
'Misc.GetSharedDirectory = /storage/emulated/0/Android/data/com.company.appname/files/shared
Zip.ZipExecutionMode = Zip.ZIP_EXECMODE_ASYNCHRONOUS
Zip.AddFolderToZip(File.DirInternal & "/Events", Misc.GetSharedDirectory & "/debugs.zip" ,"Zip")
Wait For Zip_ZipResult(Result As Int, ErrorMsg As String)
Log("ZipDone")
If Result <> Zip.ZIP_RESULT_SUCCESS Then
MsgboxAsync("There was an Error creating the Debug ZIP file, Please try again (" & ErrorMsg & ")","Zip Error")
Else
MsgboxAsync("Zip OK","ZIP")
End If
End Sub
As you can see the error message is in the log AFTER the "ZipDone" log message line, which suggests the error happens AFTER the ZIP operation has completed.
But when I check the ZIP file, it did properly "create" the zip file and it did have the folder of "Events" in it, but it did NOT properly place any files in that folder.
But If I remove the two MsgBoxAsync lines from the sub, the ZIP file will be created correctly including the files being placed in the Events folder inside the ZIP.
So, another question I have is how can an error that seems to occur AFTER the ZIP operation is complete effect whats in the zip file? If I had to take a guess, it seems the "Wait For" event is triggering BEFORE the zip operation has actually completed and because this is a resumable sub (due to "Wait For" being in it) and events are not firing when they should, things are getting messed up.
You will notice that I am setting the Zip execution mode to Async mode because this was suggested by the lib maker because when I left it set to the default "Sync" mode, it would not work with the Wait For statement at all.
Last edited: