Android Question Object context is paused. Ignoring CallSubDelayed: JobDone

cante

Member
Hello I am trying to select data from online mysql but I get this error message "Object context is paused. Ignoring CallSubDelayed: JobDone" whenever I start a new activity. How can I correctly user service to avoid this error?
 

josejad

Expert
Licensed User
Longtime User
but I get this error message "Object context is paused. Ignoring CallSubDelayed: JobDone"
Sorry, but it's difficult to help you without knowing what code you're running, what database, etc... Give us more data
 
Upvote 0

cante

Member
Main activity & Account activity:
'Main Activity

#Region  Project Attributes
    #ApplicationLabel: B4A Example
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: unspecified
    #CanInstallToExternalStorage: False
#End Region

#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
#End Region

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    Private xui As XUI
    Dim users="users" As String
    Dim name As String
End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("Layout")

End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub Button1_Click
    execute("SELECT id,username,email FROM users WHERE username='John'", users)
End Sub
Sub execute(Query As String, JobName As String)
    Dim job As HttpJob
    job.Initialize(JobName, Me)
    job.PostString("http://www.xxxxx.com/xxxx.php", Query)
End Sub

Sub jobdone (job As HttpJob)
    
If job.Success Then
    
Dim ty As String, action As String
ty = job.GetString
    
Dim parser As JSONParser
parser.Initialize(ty)
Select job.JobName
    Case users
        Dim countrie As List
        countrie = parser.NextArray
        For i = 0 To countrie.Size - 1
        Dim m As Map
        m = countrie.Get(i)
        name=m.Get("username")
        StartActivity(account)
        Next
        End Select
        End If
End Sub


'Account Activity

#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
#End Region

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
Dim users="users" As String
End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
Dim label1 As Label
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("account")
    execute("SELECT id,username,email FROM users WHERE username='"&Main.name&"'", users)
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub
Sub execute(Query As String, JobName As String)
    Dim job As HttpJob
    job.Initialize(JobName, Me)
    job.PostString("http://www.xxxxx.com/xxxx.php", Query)
End Sub
Sub jobdone (job As HttpJob)
    
    If job.Success Then
    
        Dim ty As String, action As String
        ty = job.GetString
    
        Dim parser As JSONParser
        parser.Initialize(ty)
        Select job.JobName
            Case users
                Dim countrie As List
                countrie = parser.NextArray
                For i = 0 To countrie.Size - 1
                    Dim m As Map
                    m = countrie.Get(i)
                label1.Text=m.Get("username")
                Next
        End Select
    End If
End Sub
 
Upvote 0

cante

Member
Main activity & Account activity:
'Main Activity

#Region  Project Attributes
    #ApplicationLabel: B4A Example
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: unspecified
    #CanInstallToExternalStorage: False
#End Region

#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
#End Region

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    Private xui As XUI
    Dim users="users" As String
    Dim name As String
End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("Layout")

End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub Button1_Click
    execute("SELECT id,username,email FROM users WHERE username='John'", users)
End Sub
Sub execute(Query As String, JobName As String)
    Dim job As HttpJob
    job.Initialize(JobName, Me)
    job.PostString("http://www.xxxxx.com/xxxx.php", Query)
End Sub

Sub jobdone (job As HttpJob)
   
If job.Success Then
   
Dim ty As String, action As String
ty = job.GetString
   
Dim parser As JSONParser
parser.Initialize(ty)
Select job.JobName
    Case users
        Dim countrie As List
        countrie = parser.NextArray
        For i = 0 To countrie.Size - 1
        Dim m As Map
        m = countrie.Get(i)
        name=m.Get("username")
        StartActivity(account)
        Next
        End Select
        End If
End Sub


'Account Activity

#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
#End Region

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
Dim users="users" As String
End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
Dim label1 As Label
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("account")
    execute("SELECT id,username,email FROM users WHERE username='"&Main.name&"'", users)
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub
Sub execute(Query As String, JobName As String)
    Dim job As HttpJob
    job.Initialize(JobName, Me)
    job.PostString("http://www.xxxxx.com/xxxx.php", Query)
End Sub
Sub jobdone (job As HttpJob)
   
    If job.Success Then
   
        Dim ty As String, action As String
        ty = job.GetString
   
        Dim parser As JSONParser
        parser.Initialize(ty)
        Select job.JobName
            Case users
                Dim countrie As List
                countrie = parser.NextArray
                For i = 0 To countrie.Size - 1
                    Dim m As Map
                    m = countrie.Get(i)
                label1.Text=m.Get("username")
                Next
        End Select
    End If
End Sub

Account activity reopens when I close it and click button1 in Main Activity in quick succession. Then I get this log "sending message to waiting queue (CallSubDelayed - JobDone)"
 
Upvote 0
Top