Sub btnLogin_Click
Toast.Show("Checking user and password...")
Dim Parametros() As String = Array As String(etUser.Text.Trim, etPass.Text.Trim)
Wait For(jRDC.GetRecord("Login", Parametros)) Complete (Answer As Map)
If Answer.Get("Success") Then
Dim l As List
Dim rs As DBResult
rs = Answer.Get("Data")
l = rs.Rows
If l.Size > 0 Then 'We get a result
Dim UserData As List
For Each row() As Object In l
UserData = row
Next
'Save the user name and id to build the sql queries
'Guardamos el nombre de usuario y el id para construir las sentencias sql
KVS.Put("user", etUser.Text.Trim) 'Here you set the flag to save if the user have been previously logged
KVS.Put("id_user", UserData.Get(0))
B4XPages.ShowPageAndRemovePreviousPages("Page Data")
Else
xui.MsgboxAsync("Wrong username or password", "Error")
End If
Else
xui.MsgboxAsync("Problem connecting: " & Answer.Get("Error"), "Error")
End If
End Sub