'In Process Globals
Private rp As RuntimePermissions
'In Globals
Private gMap As GoogleMap
Private MapFragment1 As MapFragment 'from designer
Private GMX As GoogleMapsExtras
Private gMarkerDragListener As OnMarkerDragListener
Private HomeMarker As Marker
Private MarkerPosition As LatLng
'In code once the layout is loaded
Wait For MapFragment1_Ready
gMap = MapFragment1.GetMap
rp.CheckAndRequest(rp.PERMISSION_ACCESS_FINE_LOCATION)
Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
If Result Then
gMap.MyLocationEnabled = True
Else
ToastMessageShow("Map permission refused - Unable to continue",True)
Activity.Finish
End If
MarkerPosition.Initialize(40,50) 'Position 40N 50E
Dim HomeBitmap As Bitmap = LoadBitmap(File.DirAssets,"home_image.png")
Dim bmd As BitmapDescriptor 'adapt the bitmap for use
Dim bmf As BitmapDescriptorFactory
bmd = bmf.FromBitmap(HomeBitmap)
'define the MarkerOptions
Dim mo As MarkerOptions
mo.Initialize
mo.Position(MarkerPosition) 'define the position
mo.Anchor(0.5,0.5) 'define where the reference position lies within the bitmap
mo.Icon(bmd) 'define the icon
mo.Draggable(True) 'make it draggable
mo.Snippet("Target Location") 'add a text snippet if required
HomeMarker = GMX.AddMarker(gMap,mo)
gMarkerDragListener.Initialize("HomeMarker") 'Setup the listener for marker drag events
GMX.SetOnMarkerDragListener(gMap,gMarkerDragListener)
.........
Sub HomeMarker_DragEnd(Marker1 As Marker)
'Here you can use Marker1.Position properties as you wish
End Sub