Dear @renato,
please take also a while to investigate the suggestion said by @anke.
She's got a huge experience in the "forest" of file handling on Android, and she has written lot of tutorials on the matter. You'll find them by digging the forum in the search tool.
Best wishes !
PS I also worked with VB (a life ago!) to make user interfaces of Siemens S7 PLC's and in that environment the synchronization with the HW was more strict and effective. But I'm talking about WinNT or Win95 and I was allowed to rise up the VB priority to the maximum, so probably the overall behaviour was closer to a RT ....
Per aspera ad astra (i.e. never give up !).
@Anke, you have essentially done what I did in my blocks. Given you didn't understand what the OP wanted in the first place, I am surprised that you even provided blocks. ( I have a long memory, well, at least a week or so )
MakeDirectory(scope,directoryName)
Create a new directory for storing files. The semantics of this method are such that it will return true if the directory exists at its completion. This can mean that the directory already existed prior to the call.
I would assume the worst, that these are long running tasks requiring completion events.
Professor Butts and the Self-Operating Napkin (1931). Soup spoon (A) is raised to mouth, pulling string (B) and thereby jerking ladle (C), which throws cracker (D) past toucan (E). Toucan jumps after cracker and perch (F) tilts, upsetting seeds (G) into pail (H). Extra weight in pail pulls cord (I), which opens and ignites lighter (J), setting off skyrocket (K), which causes sickle (L) to cut string (M), allowing pendulum with attached napkin to swing back and forth, thereby wiping chin.
For such a scheme, have each completion Event trigger the next operation.