I try to get Lat/Lon from an address using only the relevant code of the Geocoder example. The problem is that the procedure starts with the sub Geo_Start but doesn´t continue with the sub Geocoder1_GeocodeDone. In the original programm it works this way.
In the original sample the line in sub Geo_Start contains "Main." I don´t know why this reference to the main page is necessary:
B4X:
Sub Geo_Start
Dim LocationName As String
LocationName = Addr2
Geocoder1.GetFromLocationName(LocationName, MaxResults, Null)
End Sub
Sub Geocoder1_GeocodeDone(Results() As Address, Tag As Object)
If Results.Length>0 Then
Dim Address1 As Address
Dim i As Int
For i=0 To Results.Length-1
Address1=Results(i)
'ResultsList.AddSingleLine("("&Address1.Latitude&", "&Address1.Longitude&")")
Lat1 = Address1.Latitude
Lon1 = Address1.Longitude
Next
Else
Msgbox("GetFromLocation", "No Latitude and Longitude found for the LocationName")
End If
End Sub
In the original sample the line in sub Geo_Start contains "Main." I don´t know why this reference to the main page is necessary:
B4X:
Main.Geocoder1.GetFromLocationName(LocationName, MaxResults, Null)