I used some example from the community to define the current location
B4X:
myList = lm.findLastLocation("null") 'update the info to the latest available
'lm is ESLocation2 object
LatTxt.Text = NumberFormat(myList.Get(12), 0, 9)
LonTxt.Text = NumberFormat(myList.Get(13), 0, 9)
The code was working fine, and suddenly it started to fail indicating that the List has only 10 elements so the index 12,13 are out of range.
Is there any documentation to define which element of the "mylist" includes the Latitude, and which contains the longitude. I tried to use the last 2 elements, however, they do not provide the location... Any help is appreciated. Thanks
Hi,
I displayed the contents of mylist and could find that the item which value is "network" is followed by few numeric items the second and third of them are the LAT and LON.... I think, so I updated the logic to apply this logic.... It looks like working... Is that the way is expected to work?
B4X:
myList = lm.findLastLocation("null")
Dim thesize As Int
thesize=myList.Size
Dim i As Int
For i=0 To thesize-1
If myList.Get(i)="network" Then
EditText1.Text = NumberFormat(myList.Get(i+2), 0, 9)
EditText2.Text = NumberFormat(myList.Get(i+3), 0, 9)
Exit
End If
Next
If that is the case, I found other types of values other than "network" like "gps". Is it always safe to use "network"?