Android Question [SOLVED] B4A Wait For with sftp download command promptYesNo how to?


Active Member
Licensed User
EDIT: I've done it myself, see the last of my posts

I create a new project and I want to include resummable subs/wait for. Here is the working code
'sftp is a ProcessGlobal sftp object
sftp.Initialize("vers","user", "pass", "server", 21)
Wait For vers_DownloadCompleted (ServerPath As String, Success As Boolean)
If Success Then
 Log($"file was downloaded in ${Starter.rp.GetSafeDirDefaultExternal("")}/vers.txt"$)
End If
This code is good, but it will crush the app if I will not create another sub with "vers" event name
Sub vers_PromptYesNo (Message As String)
    sftp.SetPromptResult(True)'im my case is a secure server location
End Sub
So the silly question is how to integrate all this in only just one sub completly?
Last edited:


Licensed User
As there are two events i guess you should let the sub vers_PromptYesNo in your program and only wait for vers_DownloadCompleted
Upvote 0


Active Member
Licensed User
But this means that if I need to initialize another object "event2" I will need to create a second
Sub event2_PromptYesNo (Message As String)...
In this way I will repeat myself (and I'me trying not to) becouse depending on the cmplexity of the project this approach is hard to mentain.
That's why I asked his question, maybe someone else descovered a "secret shortcut" :)
Upvote 0