You can call a sub in the Activity which then update a UI Element.
Example from GPS Tutorial
Service Module
B4X:
Sub GPS_LocationChanged (Location1 As Location)
CallSub2(Main, "LocationChanged", Location1)
End Sub
Main Activity
B4X:
Public Sub LocationChanged(Location1 As Location)
lblLat.Text = "Lat = " & Location1.ConvertToMinutes(Location1.Latitude)
lblLon.Text = "Lon = " & Location1.ConvertToMinutes(Location1.Longitude)
lblSpeed.Text = $"Speed = $1.2{Location1.Speed} m/s "$
End Sub