Android Question Wait For

Dey

Active Member
Licensed User
Longtime User
Hello to all
I have a class with a timer that keeps a table from a server
This class is initialized in an activity 1
Step to other activities eg. 2 3 without making 1.Finish
Occasionally happens that the pass or return to activity 1 generates this error
I think due because activity 1 is paused or pauses
How can I fix it?
I also put a Try Catch but it is not intercepted
Unfortunately and random I can not replicate it ...
Thank you

B4X:
Expand Collapse Copy
j.Release
      'For WAIT FOR
     If SubExists(Me,"TavoloRichiestaSingolo_result") Then
                'CallSub2(mCallBack,"AggiornaTavoli_event",st)
                CallSubDelayed2(Me,"TavoloRichiestaSingolo_result",st)
     End If

0.549
0.625
0.596
An error occurred:
(Line: 1874) Return
java.lang.Exception: Sub tavolorichiestasingolo_result signature does not match expected signature.
public static void BAR.Tablet.cls_tavoli_subs_0._tavolorichiestasingolo_result(anywheresoftware.b4a.pc.RemoteObject) throws java.lang.Exception
 
Can you post the code of TavoloRichiestaSingolo_result sub?

What is st?
B4X:
Expand Collapse Copy
For n=0 To lstTavAggiorna.Size-1
            Dim st As ts_tav    'Type
            Dim at As t_tavAgg 'Type
            st=lstTavoliAll.get(n) 'utilizzo tutti i tavoli richiesti
            at=lstTavAggiorna.Get(n)
            If at.C12_time_aggiornamento <> st.C12_time_aggiornamento Then 'CE DIFFERENZA
                st.C12_time_aggiornamento = at.C12_time_aggiornamento
                TavoloRichiestaSingolo(st.C01_id_tavolo)
                Wait For TavoloRichiestaSingolo_result(st As ts_tav)
               
                If SubExists(mCallBack,"AggiornaTavoli_event") Then
                    CallSubDelayed2(mCallBack,"AggiornaTavoli_event",st)
                End If
                Exit
            End If
        Next
    Catch
        Utility.SaveLog("clsTavoli.AggiornaTavoli ERR: " & CRLF & LastException.Message)
    End Try
 
Upvote 0
What is the signature of this sub (first line)?
This is the sub
This is the sub
The problem may come from the statement
Dim st As ts_tav
And Wait For Returns the same variable name?
Thanks Erel

B4X:
Expand Collapse Copy
'Update Tables
'Example: <code>
'Wait For AggiornaTavoli_event(st as ts_tav)
'</code>
Sub AggiornaTavoli()
    Try
        If lstTavoliAll.size <>lstTavAggiorna.Size Then 'Aggiunto o rimosso tavoli
            SaleRichiesta
            TavoliRichiestaAll
            Return
        End If
      
        For n=0 To lstTavAggiorna.Size-1
            Dim st As ts_tav
            Dim at As t_tavAgg
            st=lstTavoliAll.get(n) 'utilizzo tutti i tavoli richiesti
            at=lstTavAggiorna.Get(n)
            If at.C12_time_aggiornamento <> st.C12_time_aggiornamento Then 'CE DIFFERENZA
                st.C12_time_aggiornamento = at.C12_time_aggiornamento
                TavoloRichiestaSingolo(st.C01_id_tavolo)
                Wait For TavoloRichiestaSingolo_result(st As ts_tav)
              
                If SubExists(mCallBack,"AggiornaTavoli_event") Then
                    CallSubDelayed2(mCallBack,"AggiornaTavoli_event",st)
                End If
                Exit
            End If
        Next
    Catch
        Utility.SaveLog("clsTavoli.AggiornaTavoli ERR: " & CRLF & LastException.Message)
    End Try
End Sub
 
Upvote 0
Back
Top