Android Question ArchiverPlus crashes

ilan

Expert
Licensed User
Longtime User
hi

i am using ArchiverPlus lib made by @Informatix and i am getting crashes when i try to use it.


is it a problem in the lib or maybe in my code??

this is my code:

B4X:
            Arc.AddFilesToZip(filelist,File.DirInternal & "/" & myuserid & ".zip","Archiver")   


Sub Archiver_ZipResult(Result As Int, ErrorMsg As String)
    Select Result
        Case Arc.ZIP_RESULT_SUCCESS
            Select zipid 
                Case 0
                    If File.Exists(File.DirInternal, myuserid & ".zip") Then 
                        ProgressDialogShow2(stringconvert.returnStr(55),False)
                        initializecl
                        uploadnow   
                    End If                   
                Case 1
                    Log("SUCCESSFULLY unzipped")
                    loadcontacts
            End Select
        Case Arc.ZIP_RESULT_ERROR
            Select zipid 
                Case 0
                    ToastMessageShow(stringconvert.returnStr(56),False)
                    Log("error creating zip: " & ErrorMsg)                       
                Case 1
                    ToastMessageShow(stringconvert.returnStr(57),False)
                    Log("error creating zip: " & ErrorMsg)   
            End Select
    End Select
End Sub
 

ilan

Expert
Licensed User
Longtime User
Looks like ZipResult is raised on a different thread. This is problematic.

Try to use CallSubDelayed to call a different sub from ZipResult.

I tried it but it still didnot work. Informatix send me a mail saying that the error was caused because i used a progressdialog. He said that i should not update any view or use any dialogs in the zip_result event.
 
Upvote 0

ilan

Expert
Licensed User
Longtime User
I expect CallSubDelayed to work. Have you moved all the code to the new sub that is called?

yes, you are right, using callsubdelayed did works. i used before callsubdelayed but not from the zip_result event. I thought the arc.addfilestozip(...) should be called with callsubdelayed and now i moved everything from the zipresult event and called it with callsubdelayed and it worked.

thank you very much

It's the solution that I gave in my email.

indeed, you wrote it and i follow all your instructions, i just had to get back home and try what you wrote to me. i tried it before your mail with callsubdelayed but did it wrong. anyway, thank you very much for your fast support. everything is working fine now!
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…