Android Question How do I access a control defined in Main with the Starter module

seskindell

Active Member
Licensed User
Longtime User
Trying to access a edittext control that is defined in the Main module from the Starter Module.

Any ideas?

Thank you,
Steve
 

DonManfred

Expert
Licensed User
Longtime User
You can´t!

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
 
Upvote 0
Top