B4J Tutorial [BANAnoWebix] Lesson 20 Google Map

Mashiane

Expert
Licensed User
Ola

Simply put, this google map allows one to display a google map on their apps. One is able to also add markers that properties can be set up for.

Lesson20GoogleMap.gif


One needs to get their own google map key to use this on their app.

In this instance, we create a google map instance, set its map type, add some markers and then trap the click event of markers.

B4X:
'
    Dim R1 As WixRow
    R1.Initialize("R1")
    '
    gmap.Initialize("gmap").SetWidth(640).SetHeight(480).SetBorderLess(False).SetStyle("margin", "10px")
    gmap.SetKey("YOUR-KEY-HERE").SetZoom(6).SetMapType(gmap.MAP_TYPE_ROADMAP)
    gmap.SetCenter(25.335, 2.324)
    '
    'add markers
    gmap.AddMarker("1", 25.355, 2.324, "Point A", True, False)
    gmap.AddMarker("2", 25.444, 5.43, "Point B", False, False)
    gmap.AddMarker("3", 25.123, 12.375, "Point C", False, False)
    '
    R1.AddItem(gmap.Item)
   
    pg.AddRow(R1)
    '
    pg.ui
    Dim maID As String
    pg.OnItemClick("gmap", BANano.CallBack(Me,"marker_click", Array(maID)))
 
Top