I have three b4xpages :
main, b4xMainPage(splash) that transfers to B4xpage2, in B4xpage2 i have a button view to start a Start module that contains this method GpsStatus (Satellites As List), how do I pass sb.string to a label view that is located in B4xpage2, thaks in advanced.
main, b4xMainPage(splash) that transfers to B4xpage2, in B4xpage2 i have a button view to start a Start module that contains this method GpsStatus (Satellites As List), how do I pass sb.string to a label view that is located in B4xpage2, thaks in advanced.
B4X:
Public Sub GpsStatus (Satellites As List)
Dim sb As StringBuilder
sb.Initialize
sb.Append("GPS Status:").Append(CRLF)
Dim NumberOfSatellites As Int = Satellites.Size
Dim Beidou, Galileo, Glonass, Gps, Other As List
Beidou.Initialize
Galileo.Initialize
Glonass.Initialize
Gps.Initialize
Other.Initialize
Dim usedinfix As Int = 0
Dim sb As StringBuilder
sb.Initialize
sb.Append("GPS Status").Append(CRLF)
For i = 0 To NumberOfSatellites - 1
Dim gpsat As GPSSatellite = Satellites.Get(i)
If gpsat.Prn > 300 Then
Galileo.Add(i)
Else If gpsat.Prn > 200 Then
Beidou.Add(i)
Else If gpsat.Prn > 64 Then
Glonass.Add(i)
Else
Gps.Add(i)
End If
If gpsat.UsedInFix Then usedinfix = usedinfix + 1
Next
sb.Append($"Beidou ${Beidou.Size} : "$)
For i = 0 To Beidou.Size -1
Dim gpsat As GPSSatellite = Satellites.Get(Beidou.Get(i))
sb.Append(gpsat.Prn).Append(" ")
Next
sb.Append(CRLF)
sb.Append($"Galileo ${Galileo.Size} : "$)
For i = 0 To Galileo.Size - 1
Dim gpsat As GPSSatellite = Satellites.Get(Galileo.Get(i))
sb.Append(gpsat.Prn).Append(" ")
Next
sb.Append(CRLF)
sb.Append($"Glonass ${Glonass.Size} : "$)
For i = 0 To Glonass.Size -1
Dim gpsat As GPSSatellite = Satellites.Get(Glonass.Get(i))
sb.Append(gpsat.Prn).Append(" ")
Next
sb.Append(CRLF)
sb.Append($"Gps ${Gps.Size} : "$)
For i = 0 To Gps.Size -1
Dim gpsat As GPSSatellite = Satellites.Get(Gps.Get(i))
sb.Append(gpsat.Prn).Append(" ")
Next
sb.Append(CRLF)
sb.Append($"Satellites : ${NumberOfSatellites}"$).Append(CRLF)
sb.Append($"Used in fix: ${usedinfix}"$).Append(CRLF)
' lblSatellites.Text = sb.ToString
Log(sb.ToString)
Dim Page As B4XPage2
Page.Initialize
Page.Labelgnss.Text=sb.ToString
'java.lang.RuntimeException: Object should first be initialized (B4XView).
End Sub