I am using OSMDroid to create a navi for waterways. It is basically working but....
The main activity calls the navi activity via the TouchEventsOverlay1_LongCLick event. The navi activity calculates a path and creates a series of markers stored in list "Markers", which is globally dimensioned in the main activity. After finishing the navi activity, the main resume event is called and using the rapid debugger, I can see that there are eg. 15 markers in the list but they do not show on the map.
Can anyone see what is going on in the code before I have to post the whole source code?
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
			
			The main activity calls the navi activity via the TouchEventsOverlay1_LongCLick event. The navi activity calculates a path and creates a series of markers stored in list "Markers", which is globally dimensioned in the main activity. After finishing the navi activity, the main resume event is called and using the rapid debugger, I can see that there are eg. 15 markers in the list but they do not show on the map.
Can anyone see what is going on in the code before I have to post the whole source code?
			
				B4X:
			
		
		
		Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    Dim TileSource As String="Mapnik"                                        'Mapnik, OSMPublicTransport, MapquestOSM
    Dim dt As String="Maptemp"                                                            'Filename for screenshot
    Dim FirstPointLon, FirstPointLat, SecondPointLon, SecondPointLat As Double            'Gps coordinates of start and finish markers
    Dim FirstPointClicked As Boolean=False
    Dim Timer1 As Timer                                                                    'Used to create a delay
    Dim NordValues(4) As Double                                                            'Returns lat & lon of bounding box for markers
    Dim ActWidth, ActHeight As Int                                                        'activity height & width
    Dim Markers As List
End Sub
Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
    Dim MapView1 As MapView
    Dim MapCenter As GeoPoint
    Dim TouchEventsOverlay1 As TouchEventsOverlay                                        'Allows click & long click events
    Dim SimpleLocationOverlay1 As SimpleLocationOverlay
'    Dim BoundaryBox As BoundingBox
   
   
    Dim FirstMarker, SecondMarker As Marker
    Dim MarkersOverlay1 As MarkersOverlay   
   
End Sub
Sub Activity_Create(FirstTime As Boolean)
   'Do not forget to load the layout file created with the visual designer. For example:
   'Activity.LoadLayout("Layout1")
   
   Markers.Initialize   'initialise list for markers
   Timer1.Initialize( "Timer1",500)
   
   '  pass an EventName when initializing the MapView
     '  MapView has two events: CenterChanged and ZoomChanged
   MapView1.Initialize("MapView1")
   Activity.AddView(MapView1, 0, 0, 100%x, 100%y)
   
   MapView1.SetMultiTouchEnabled(True)
   MapView1.SetZoomEnabled(True)
   MapCenter.Initialize(47.3763900,15.0911300)   'Leoben as center
    
   MapView1.Zoom=15
   MapView1.SetCenter(47.3763900,15.0911300)
   MapView1.SetTileSource(TileSource)
   Activity.Title="OSMDroid ["&MapView1.Zoom&"]"
   
   'Log("MapView1.Center: " & MapView1.GetCenter)
         
   'initialize the SimpleLocationOverlay and add it to the MapView
     SimpleLocationOverlay1.Initialize(MapView1)
     MapView1.AddOverlay(SimpleLocationOverlay1)
     
     'set the SimpleLocationOverlay to display it's icon at the map center
     SimpleLocationOverlay1.SetMyLocation3(MapView1.GetCenter)
   
   'initialize the MarkersOverlay and add it to the MapView
     'an EventName is required as we will listen for the two events that MarkersOverlay generates
  MarkersOverlay1.Initialize(MapView1, "") 'No events
  MapView1.AddOverlay(MarkersOverlay1)
     
   'Add touch events to map
   TouchEventsOverlay1.Initialize("TouchEventsOverlay1")
  MapView1.AddOverlay(TouchEventsOverlay1)
         
   'Log("Before Timer1: " & MapView1.GetBoundingBox2(MapView1.Width, MapView1.Height))
   'Log(MapView1.GetBoundingBox)
     
   Timer1.Enabled=True   'Wait for a short period for map to finish drawing
   
End Sub
Sub Activity_Resume
   'We return here when pathfinder activity is closed
   MarkersOverlay1.RemoveMarkers
   MapView1.RemoveOverlay(MarkersOverlay1)
   MapView1.Invalidate
   
   'initialize the MarkersOverlay and add it to the MapView
     'an EventName is required as we will listen for the two events that MarkersOverlay generates
  MarkersOverlay1.Initialize(MapView1, "") 'No events
  MapView1.AddOverlay(MarkersOverlay1)
   
   'add the List of Markers to the MarkersOverlay
  MarkersOverlay1.AddMarkers(Markers)
   Log("Markers: " & Markers.Size)
   Activity.Invalidate
End Sub