Android Question ArchiverPlus crashes

Discussion in 'Android Questions' started by ilan, Jul 13, 2018.

  1. ilan

    ilan Expert Licensed 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:

    Code:
    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
     
  2. ilan

    ilan Expert Licensed User

    the weird thing is that it is working in debug mode but not in release mode. why?
     
  3. Erel

    Erel Administrator Staff Member Licensed User

    Looks like ZipResult is raised on a different thread. This is problematic.

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

    ilan Expert Licensed User

    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.
     
  5. Erel

    Erel Administrator Staff Member Licensed User

    I expect CallSubDelayed to work. Have you moved all the code to the new sub that is called?
     
  6. ilan

    ilan Expert Licensed User

    I am now at work so when i will get home i will try and let u know.
     
  7. Informatix

    Informatix Expert Licensed User

    It's the solution that I gave in my email.
     
    Erel likes this.
  8. ilan

    ilan Expert Licensed User

    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 :)

    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!
     
    Informatix likes this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice