Android Question googlemap/googlemapextra how change marker position

marcick

Well-Known Member
Licensed User
Longtime User
I'm playing with these nice library.
I use this code to place a marker with a custom icon

B4X:
Dim Icon As Bitmap
      Icon.Initialize(File.DirAssets, "alarm.png")
      MarkerOptions1.Position2(45.00274,8.95789).Snippet("snp").Title("tit").Visible(True)
      Dim BitmapDescriptor1 As BitmapDescriptor
      Dim BitmapDescriptorFactory1 As BitmapDescriptorFactory
      BitmapDescriptor1=BitmapDescriptorFactory1.FromBitmap(Icon)
      MarkerOptions1.Icon(BitmapDescriptor1)
      MarkerOptions1.Anchor(0.5,0.5)
      Dim Marker1 As Marker=GoogleMapsExtras1.AddMarker(gmap, MarkerOptions1)

now, I can't find how to change its position, change its icon or remove it

If I use for example

B4X:
MarkerOptions1.Position2(45.00274,9)

It has no effect, maybe something like "refresh" is missing ?

Marco
 

Ohanian

Active Member
Licensed User
Longtime User
Hi,

define the Marker1 variable as a global variable, and use this code to reset it's postion :

B4X:
Dim NewPosition As LatLng
NewPosition.Initialize(NEWLAT, NEWLON)
Marker1.Position = NewPosition

to remove :
B4X:
Marker1.Remove
 
Upvote 0

marcick

Well-Known Member
Licensed User
Longtime User
Thanks Ohanian,
and to change the icon ?
Need to remove it and create a new one ?
 
Upvote 0

Rung

Member
Licensed User
Longtime User
Hi,
How to create many markers with various positions and snippet?

Many thanks for anyone help.
RUNG
 
Upvote 0
Top