Android Question why marker properties does not change ?

Discussion in 'Android Questions' started by marcick, May 8, 2015.

  1. marcick

    marcick Well-Known Member Licensed User

    In this code, I see the changes in the log, but nothing happens on the map.
    Also Marker1.remove or any other action on the marker has not effect
    Where I'm wrong ?

    Code:
    Sub Mapfragment1_MarkerClick (Marker1 As MarkerAs Boolean
          
        
    Log(Marker1.Snippet)
        Marker1.Snippet=
    "new snippet"
        
    Log(Marker1.Snippet)
     
    ''   Marker1.remove 
       
       
    Return True
      
    End Sub
     
  2. Croïd

    Croïd Active Member Licensed User

    Try Mapfragment1_MarkerClick (SelectedMarker As Marker) As Boolean
     
  3. marcick

    marcick Well-Known Member Licensed User

    ....
    the MarkerClick event already contains the selected marker, you can call it "marker1", "selectedmarker", there is no difference
    Am I wrong ?
     
  4. Croïd

    Croïd Active Member Licensed User

  5. marcick

    marcick Well-Known Member Licensed User

    No difference
     
  6. eurojam

    eurojam Well-Known Member Licensed User

    I have tried your example. It works as it should...
    Code:
    Sub Activity_Create(FirstTime As Boolean)
       MapPanel.Initialize(
    "")
       
    Activity.AddView(MapPanel, 00100%x100%y)
       
    If mFragment.IsGooglePlayServicesAvailable = False Then
          
    ToastMessageShow("Google Play services not available."True)
       
    Else
          mFragment.Initialize(
    "Map", MapPanel)
       
    End If
    End Sub

    Sub Map_Ready
       
    Log("map ready")
       gmap = mFragment.GetMap
       
    If gmap.IsInitialized = False Then
            
    ToastMessageShow("Error initializing map."True)
       
    Else 
            
    Dim MarkerOptions1 As MarkerOptions
            MarkerOptions1.Initialize

            
    Dim Marker1 As Marker
            
    Dim Marker2 As Marker
            Marker1= gmap.AddMarker( 
    64.4761918.3980,"pkt1"',LoadBitmap(File.DirAssets, "icon1.png")) ' Ok so far
            Marker1.Snippet= "pkt1"
            MarkerOptions1.Position2(
    64.9961917.3980).Snippet("pkt2").Title("pkt2")
            Marker2=GoogleMapsExtras1.AddMarker(gmap, MarkerOptions1)    
     
            
    Dim cp As CameraPosition
            cp.Initialize(
    6418, gmap.CameraPosition.Zoom)
            gmap.AnimateCamera(cp)
       
    End If
    End Sub
    Sub Map_MarkerClick (SelectedMarker As MarkerAs Boolean 'Return True to consume the click
        Log(SelectedMarker.Snippet)
        SelectedMarker.Snippet=
    "new snippet"
        
    Log(SelectedMarker.Snippet)
        
    'Return True
    End Sub
     
  7. marcick

    marcick Well-Known Member Licensed User

    thanks, let me check where I'm wrong and I'll come back.
     
  8. marcick

    marcick Well-Known Member Licensed User

    It works ...
    After changing the snippet, there was another wrong part of code that restored the old snippet, so I didn't see the difference.
    ANyway you can call it "SeelectedMarker" or "MyMarker" that it works.
    Thanks Croid and Eurojam, bye
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice