invoke txtcall from activity module to a service module

fifiddu70

Well-Known Member
Licensed User
Longtime User
I have an activity where I added a button, and a editext I also a module service to launch an application in the background, the application I would recognize the inserted text on editext, how do I invoke the event from an activity to a service? place an example.

B4X:
Sub Process_Globals
   'These global variables will be declared once when the application starts.
   'These variables can be accessed from all modules.

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 btnSalva As Button
   Dim lblInfo As Label
   Dim txtcall As EditText
        Dim txtcall2 As EditText
End Sub

Sub Activity_Create(FirstTime As Boolean)
   Activity.LoadLayout("abilita")
   p.SetScreenOrientation(1)
   lblInfo.SetLayout(0%X,0%Y,100%X,5%Y)
   txtcall.SetLayout(0%X,6%Y,100%X,9%Y)
        txtcall.SetLayout(0%X,10%Y,100%X,9%Y)
        btnSalva.SetLayout(0%X,30%Y,100%X,9%Y)
        btnEntra.SetLayout(0%X,50%Y,100%X,9%Y)
   End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub btnSalva_Click
     if txtcall.text = txtcall2.text then
   msgbox("ok","confermato")
        btnEntra.enabled = true
   else
        msgbox("non uguale","attenzione")
        btnEntra.enabled = false
End Sub

this is service module:

B4X:
Sub Process_Globals
   'These global variables will be declared once when the application starts.
   'These variables can be accessed from all modules.
    Dim SI As SmsInterceptor
    Dim sound As MediaPlayer
    End Sub
Sub Service_Create
   SI.Initialize2("SI",999)
   sound.Initialize2("sound")
   
   
End Sub

Sub Service_Start (StartingIntent As Intent)
   
   StartServiceAt("", DateTime.Now + 0.1 * DateTime.TicksPerMinute, False)
   
End Sub

Sub Service_Destroy

End Sub
Sub SI_MessageReceived (From As String, Body As String) As Boolean
      If Body = txtcall.text Then 
   sound.Load(File.DirAssets,"allarme.WAV")
   sound.Play
   Return True

the problem and do not know how to invoke the txtcall of activity in the service module, I hope I have been clear.
 
Last edited:
Top