Android Question Wait For UnZipDone

watesoft

Active Member
Licensed User
Longtime User
B4X:
Dim uz As Archiver
    File.Copy(File.DirAssets,"AB.zip",File.DirInternal,"AB.zip")
    uz.AsyncUnZip(File.DirInternal,"AB.zip",File.DirInternal,"uz")
    Wait For uz_UnZipDone(Completed As Boolean, Files As Int)
    
    If Completed=True Then
        Dim str_A As String=File.ReadString(File.DirInternal,"D.dat")
        MsgboxAsync(str_A.Length,"")
    End If

I use Archiver to unzip AB.zip file which contains 4 large files(A.dat, B.dat, C.dat, D.dat), then do something else. Use above code, some of the files could not be found, proving that the decompression process had not been completed,how to wait for the decompression to finish?

B4X:
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create (first time) **
** Activity (main) Resume **
Error occurred on line: 33 (Main)
java.io.FileNotFoundException: /data/user/0/b4a.example/files/C.dat (No such file or directory)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(FileInputStream.java:146)
    at anywheresoftware.b4a.objects.streams.File.OpenInput(File.java:215)
    at anywheresoftware.b4a.objects.streams.File.ReadString(File.java:277)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:348)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:157)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:201)
    at anywheresoftware.b4a.shell.DebugResumableSub$RemoteResumableSub.resume(DebugResumableSub.java:22)
    at anywheresoftware.b4a.BA.checkAndRunWaitForEvent(BA.java:275)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:150)
    at anywheresoftware.b4a.BA$2.run(BA.java:395)
    at android.os.Handler.handleCallback(Handler.java:751)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:154)
    at android.app.ActivityThread.main(ActivityThread.java:6121)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)
** Activity (main) Pause, UserClosed = true **
** Service (starter) Destroy (ignored)**
 

Attachments

  • UnZip.zip
    9.2 KB · Views: 185

DonManfred

Expert
Licensed User
Longtime User
the zip file inside is missing
 
Upvote 0

watesoft

Active Member
Licensed User
Longtime User
the zip file inside is missing
Sorry,The file is too large to upload, you can randomly use 4 large files with the same name, and then select all of them, right mouse button to send to the compressed file, and then name AB.zip.
 
Upvote 0

teddybear

Well-Known Member
Licensed User
Error occurred on line: 33 (Main)
java.io.FileNotFoundException: /data/user/0/b4a.example/files/C.dat (No such file or directory)
B4X:
Dim str_A As String=File.ReadString(File.DirInternal,"D.dat")
In your code ,you would like to read file D.dat, why it is C.dat which not found in the errlog , where do you read the C.dat?
 
Upvote 0

watesoft

Active Member
Licensed User
Longtime User
B4X:
Dim str_A As String=File.ReadString(File.DirInternal,"D.dat")
In your code ,you would like to read file D.dat, why it is C.dat which not found in the errlog , where do you read the C.dat?
It's only an example, actually every file need to be judged.
 
Upvote 0
Top