Sub MapFragment1_Ready
    Sleep(500)
    Log("MapFragment1_Ready")
    Log(MapFragment1.GetOpenSourceLicenseInfo)
    
    gmap = MapFragment1.GetMap
    gmap.MapType = gmap.MAP_TYPE_NORMAL
'    If GPSModule.Address.EqualsIgnoreCase("") Then
'        GetMapByAddress(JobMain.JobAddress)
'    Else
'        GetDirections(GPSModule.Address,JobMain.JobAddress)
'    End If
    If  gmap.IsInitialized = False Then
        ToastMessageShow("Error initializing map.", True)
    End If
    Try
        If GPSModule.Location.EqualsIgnoreCase("") Then
            GetMapByAddress(JobMain.JobAddress)
            
            Dim m2 As Marker = gmap.AddMarker(GPSModule.latitude,GPSModule.longitude, "You Are Here")
            m2.Snippet = "Current Location"
        Else
            Log("get map failed")
        End If
        
    '    Dim line As Polyline
    '    Dim points As List
    '    Dim point As LatLng
    '    line=gmap.AddPolyline
    '    points.Initialize
        
    '    line.color=Colors.Black
    '    line.Geodesic=True
    '    line.Visible =True
    '    line.Width=2
        'line.Points=points
    Catch
        Log("ERROR" & LastException.Message)
    End Try
End Sub
Sub GetMapByAddress (aDD As String)
    Dim gg As Geocoder   
    gg.Initialize("gg")   
    gg.GetFromLocationName(aDD,5,Null)     
End Sub
Sub gg_GeocodeDone(Results() As Location, Tag As Object)   
    xfs.WriteTextWriterDim("gg_GeocodeDone")
    If Results.Length > 0 Then
        Dim Location1 As Location
        Dim i As Int
    
        For i=0 To Results.Length-1
            Location1=Results(i)
            cpLat = Location1.Latitude
            cpLong = Location1.Longitude
'            'gmap.AddMarker(cpLat, cpLong, Main.documentID & CRLF & Main.dlvName)       
        Next
        Log("Try")
        Dim m1 As Marker = gmap.AddMarker(cpLat, cpLong, JobMain.JobAddress)
        m1.Snippet = Main.jobs.record.TransID
    Else
        ToastMessageShow("Location not found!", False)
    End If
    cp.Initialize(cpLat, cpLong, 15)
    gmap.AnimateCamera(cp)
End Sub