Android Question Returning a value from resumable sub in class module using jRDC2

hi guys, i just create a class module that store all of my service like CRUD into my db, look like this:

Class AuthService:
Sub Class_Globals
    Dim requestSuccess As Boolean
End Sub

'Initializes the object. You can add parameters to this method if needed.
Public Sub Initialize
    
End Sub

public Sub RegisterNewUser2(args() As Object) As ResumableSub
    Dim cmd As DBCommand = Utility.CreateCommand("registerUser", Array(args(1), args(2), args(3)))
    Dim j As HttpJob
    j.Initialize("j", args(0))
    j = Utility.CreateRequest(args(0)).ExecuteBatch(Array(cmd), Null)
    Wait For(j) JobDone(j As HttpJob)
    Return j.Success
End Sub

and i already initialize authservice class in my starter service like this :

Starter Service:
Sub Service_Start (StartingIntent As Intent)
    authService.Initialize
End Sub

and i called the RegisterNewUser2 from my authservice class in my register activity like this :

Register Activity:
sub button1_Click
        Wait For(Starter.authService.RegisterNewUser2(Array As Object(Me, txtUsername.Text, txtPassword.Text, txtEmail.Text))) Complete (Success As Boolean)
        If Success Then
            StartActivity(Main)
            Activity.FInish
        Else
            ViewHelper.ShowSnackBar(Activity, "Registrasi gagal")
        End If
End Sub

the data successfully inserted into my db but theevent not triggered
 
Switch to B4XPages and everything will be simpler. Especially in cases such as the this.


Which event?

hi erel, but the project is quiet complex if i switch everything to b4xpages..

event on this line :

Event:
sub button1_Click
        Wait For(Starter.authService.RegisterNewUser2(Array As Object(Me, txtUsername.Text, txtPassword.Text, txtEmail.Text))) Complete (Success As Boolean)
        If Success Then
            StartActivity(Main)
            Activity.FInish
        Else
            ViewHelper.ShowSnackBar(Activity, "Registrasi gagal")
        End If
End Sub

the data successfully inserted that mean the "Success" Param in Complete will be true..
but startActivty not triggered...
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…