Sub Process_Globals
Dim cursor1 As Cursor
Dim SQL1 As SQL
Dim Addr2, Lat1, Lat2, Lon1, Lon2 As String
End Sub
Sub Globals
Dim LVDb As ListView
Dim Dist
Dim Geocoder1 As Geocoder
End Sub
Sub Activity_Create(FirstTime As Boolean)
Geocoder1.Initialize("Geocoder1")
Activity.LoadLayout("DBListView")
If SQL1.IsInitialized = False Then
SQL1.Initialize(File.DirInternal, "mydb_db.sql", False)
End If
LVDb.Clear
LVDb.SingleLineLayout.ItemHeight = 120
LVDb.SingleLineLayout.Label.TextSize = 20
LVDb.SingleLineLayout.Label.TextColor = Colors.White
LVDb.SingleLineLayout.Label.Color = Colors.Black
cursor1 = SQL1.ExecQuery("SELECT * FROM tblUsers")
For i = 0 To cursor1.RowCount - 1
cursor1.Position = i
Addr2 = cursor1.GetString("Addr")
Geo_Start
LVDb.AddSingleLine(cursor1.GetString("ID")& ") " & cursor1.GetString("Name") & " " & Lat1 & " " & Lon1)
Next
End Sub
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)
Lat1 = Address1.Latitude
Lon1 = Address1.Longitude
Next
Else
Msgbox("GetFromLocation", "No Latitude and Longitude found for the LocationName")
End If
End Sub