Android Question copy file in resumablesub

coddy

Member
hi
i'm going to make share when the app is starting to run two file be in external directory and if they're not there copy them and after that continue running .this is the code but it seems not waiting for the sub to be complete.
copyfile in resumable sub:
Sub copyFiles(temp As Boolean)As ResumableSub
    Dim flag As Boolean
    temp = 0
    flag = False
    Try
        If File.Exists(File.DirDefaultExternal,"cool.pol") = False Then
            Wait For (File.CopyAsync(File.DirAssets,"cool.pol",File.DirDefaultExternal,"cool.pol")) Complete (Success1 As Boolean)
        End If
        If File.Exists(File.DirDefaultExternal,"rest.pol") = False Then
            Wait For (File.CopyAsync(File.DirAssets,"rest.pol",File.DirDefaultExternal,"rest.pol")) Complete (Success2 As Boolean)
        End If
        
        If Success1 And Success2 Then
            flag = True
        End If
    Catch
        SendErrorReport(LastException.Message)
    End Try
    
    If flag = False Then
        restartApp
    End If   
End Sub
 
Top