Android Question recursive folder copy: when finished ?

DonManfred

Expert
Licensed User
Longtime User
Add some sleep and wait for and make it all a resumeable sub so you should be able to get the result.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
This code is synchronous.

B4X:
CopyFolder(...)
Log("This is the next statement)

If it is too slow then you should switch to File.CopyAsync. In that case the sub will be resumable and you will need to call it like this:
B4X:
Wait For (CopyFolder(...)) Complete (Success As Boolean)
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
This code is synchronous.
If so, the whole recursive loop should finish after all copied, correct ?
I found in my app that if to finish activity just after CopyFolder - many files\subforders are not copied yet.
If do not finish - all are OK. I guessed that many recursive calls are in the memory and the finish moment is not known well.
How to understand ?
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
So, in your recursive code each file copy should finish before next file copying without File.CopyAsync? But ... not finished.
 
Upvote 0
Top