#Region Project Attributes
#ApplicationLabel: GOOGLE MAPS ON WEBVIEW
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
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.
Private WebView_ex As WebViewExtras
Private WebView1 As WebView
Private Button1 As Button
Private Button2 As Button
Private Button3 As Button
Private Button4 As Button
Private Button5 As Button
Private Button6 As Button
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("L1")
Dim x As String
'mymap.Initialize2(Me,"mymap",WebView1)
x=File.ReadString(File.DirAssets,"YOUR_HTML_FILE.txt")
WebView1.LoadHtml(x)
WebView_ex.addJavascriptInterface(WebView1, "B4A")
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub WebView1_PageFinished (Url As String)
Log("Map loaded on Page")
End Sub'
'initilize action s for new map
'initialize2(CenterLat,CenterLag,zoom)
Sub Button1_Click
Dim lat1,lat2,lag1,lag2 As Double
Dim zoom As Int
lat1=41.022222
lag1=28.751112
zoom=15
WebView_ex.executeJavascript(WebView1, "initialize2("&lat1&","&lag1&","&zoom&")")
End Sub
' calculate and draw for 2 points
'center>>"Lat,Lag"
'poiadd2(Center1,Center2)
Sub Button2_Click
Log("Route drawing...")
Dim lat1,lat2,lag1,lag2 As Double
lat1=0'41.026742
lat2=0'41.073524
lag1=28.805635
lag2=28.913170
WebView_ex.executeJavascript(WebView1, "calcRoute2('"&lat1&", "&lag1&"','"&lat2&", "&lag2&"')")
End Sub
Sub Button6_Click
Log("settding Center...")
Dim lat1,lat2,lag1,lag2 As Double
Dim zoom As Int
lat1=41.011111
lag1=28.705635
zoom=14
Log("Marker adding...")
WebView_ex.executeJavascript(WebView1, "SetCenter("&lat1&","&lag1&")")
End Sub
Sub Button5_Click
Log("reading Center...")
WebView_ex.executeJavascript(WebView1, "ReadCenter()")
End Sub
'delete last marker/poi
Sub Button3_Click
Log("Marker deleting...")
WebView_ex.executeJavascript(WebView1, "poidelete()")
End Sub
' add MARKER/POİ on map with animated
' poiadd2(Lat,Lag,zoom)
Sub Button4_Click
Dim lat1,lat2,lag1,lag2 As Double
Dim zoom As Int
lat1=41.011111
lag1=28.705635
zoom=14
Log("Marker adding...")
WebView_ex.executeJavascript(WebView1, "poiadd2("&lat1&","&lag1&","&zoom&")")
End Sub
'***********************************************************************************
'***************** THESE SUBS RETURN FROM GOOGLE MAP ON WEBVIEW**********************************************
'***********************************************************************************
Sub MyMap_initialized(Statuts As String)
Log("Map initilazed and showed map")
ToastMessageShow("Map initilazed and showed map",True)
End Sub
Sub MyMap_Poi_Added(Statuts As String)
Log("NEw poi addded on map")
ToastMessageShow("NEw poi addded on map",True)
End Sub
Sub MyMap_Poi_Deleted(Statuts As String)
Log("Last poi deleted on map")
ToastMessageShow("Last poi deleted on map",True)
End Sub
Sub MyMap_Calc_Distance(Statuts As String)
Log ("Distance for between A - B :" &Statuts)
ToastMessageShow("Distance for between A - B :" &Statuts,True)
End Sub
Sub MyMap_Calc_Distance_Err(Statuts As String)
Log("Route error, No way...")
ToastMessageShow("Route error, No way...",True)
End Sub
Sub MyMap_ReadCenter(Statuts As String)
Log("center:" & Statuts)
ToastMessageShow("center:"&Statuts,True)
End Sub
Sub MyMap_SetCenter(Statuts As String)
Log("Setcenter:" & Statuts)
ToastMessageShow("Set center:"&Statuts,True)
End Sub