Hi
How can I use Wait to tell me when I am finish to save the file so I can close the ProgressDialog
How can I use Wait to tell me when I am finish to save the file so I can close the ProgressDialog
B4X:
Sub check_upgrade As ResumableSub
Private AppVer As Int = Application.VersionCode
Dim sf As Object = Starter.mysql.ExecQueryAsync("mysql", "SELECT file,version from upgrade WHERE ID LIKE '" & "1" & "%'", Null)
Wait For (sf) mysql_QueryComplete (Success As Boolean, Crsr As JdbcResultSet)
If Success Then
Do While Crsr.NextRow
Dim b() As Byte = Crsr.GetBlob("file")
Dim newversion As String = Crsr.GetString("version")
Loop
End If
If newversion = Null Then newversion = 0
If AppVer < As Then
Msgbox2Async("Do you want to download?","It is new version","Yes","","No",Null,False)
Wait For Msgbox_Result (Result As Int)
If Result = DialogResponse.POSITIVE Then
ProgressDialogShow("Download")
saveAPK(b)
Sleep(0)
ProgressDialogHide
End If
End If
Return Success
End Sub
Public Sub saveAPK(data() As Byte) As ResumableSub
Dim out As OutputStream = File.OpenOutput(Starter.Provider.SharedFolder, "tt.apk", False)
out.WriteBytes(data, 0, data.Length)
out.Close
Return out
End Sub