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