Sub Process_Globals
End Sub
Sub Globals
Dim ContainerPanel As Panel
Dim GoogleMap1 As GoogleMap
Dim InfoWindowPanel As Panel
Dim MapFragment1 As MapFragment
Dim MapPanel As Panel
Dim Markers As Map
Dim SnippetLabel As Label
Dim ThumbImage As ImageView
Dim TitleLabel As Label
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Main")
If MapFragment1.IsGooglePlayServicesAvailable = False Then
ToastMessageShow("Google Play services not available.", True)
Else
MapFragment1.Initialize("MapFragment1", MapPanel)
End If
End Sub
Sub MapFragment1_Ready
Log("MapFragment1_Ready")
GoogleMap1 = MapFragment1.GetMap
If GoogleMap1.IsInitialized = False Then
ToastMessageShow("Error initializing map.", True)
Else
Dim GoogleMapsExtras1 As GoogleMapsExtras
Dim InfoWindowAdapter1 As InfoWindowAdapter
InfoWindowAdapter1.Initialize("InfoWindowAdapter1")
GoogleMapsExtras1.SetInfoWindowAdapter(GoogleMap1, InfoWindowAdapter1)
InfoWindowPanel.Initialize("")
InfoWindowPanel.LoadLayout("InfoWindow")
' a hack(ish) way to set InfoWindowPanel width and height!
MapPanel.AddView(InfoWindowPanel, 0, 0, 280dip, 120dip)
InfoWindowPanel.RemoveView
Markers.Initialize
Dim Marker1 As Marker
Marker1=GoogleMap1.AddMarker(52.75619, 0.3980, "Home Sweet Home")
Marker1.Snippet="Home is where the heart is!"
Markers.Put(Marker1, Marker1)
Dim Marker1 As Marker
Marker1=GoogleMap1.AddMarker(52.93514, 0.4829, "Hunstanton")
Marker1.Snippet="A charming seaside town. Popular with the tourists."
Markers.Put(Marker1, Marker1)
Dim CameraPosition1 As CameraPosition
CameraPosition1.Initialize(52.75619, 0.3980, 8)
GoogleMap1.AnimateCamera(CameraPosition1)
End If
End Sub
Sub InfoWindowAdapter1_GetInfoContents(Marker1 As Marker) As View
' Return Null
' the default InfoContent will be used if this event Sub is not defined or if it returns Null
Log("InfoWindowAdapter1_GetInfoContents")
TitleLabel.Text=Marker1.Title
SnippetLabel.Text=Marker1.Snippet
' ThumbImage.Bitmap=? how will you store the file path/file name of the image to display?
' it's a shame that the Marker object has no Tag property which could be used to store such info
Return InfoWindowPanel
End Sub