#Region Activity Attributes
#FullScreen: true
#IncludeTitle: false
#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 xui As XUI
Private helpview As WebView 'See Sub helpview_OverrideUrl (Url As String) As Boolean
'Private ph1 As Phone
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")
Activity.LoadLayout("helplay")
'ph1.SetScreenOrientation(0) '-1 Unspecified, 0 - Landscape, 1 - Portrait
'helpview.LoadURL("file:///android_asset/helpfile.htm") 'Erel said "don't use this".
'helpview.Loadurl(WebViewAssetFile("helpfile.htm")) 'Erel said "use this with Sub below".
helpview.LoadUrl($"${xui.FileUri(File.DirAssets, "helpfile.htm")}"$) 'Then Erel said use this [possibly years later]
End Sub
'Sub WebViewAssetFile (FileName As String) As String
' Dim jo As JavaObject
' jo.InitializeStatic("anywheresoftware.b4a.objects.streams.File")
' If jo.GetField("virtualAssetsFolder") = Null Then
' Return "file:///android_asset/" & FileName.ToLowerCase
' Else
' Return "file://" & File.Combine(jo.GetField("virtualAssetsFolder"), _
' jo.RunMethod("getUnpackedVirtualAssetFile", Array As Object(FileName)))
' End If
'End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub helpview_OverrideUrl (Url As String) As Boolean 'ignore
'Accessing a URL via a link in a Webview may have limitations.
'This Sub intercepts the URL (Url As String) and calls the default browser to access the URL.
'Note: The "helpview" part of the Sub name is the name of the Webview defined in Sub Globals.
Dim p As PhoneIntents
Dim message As Email
helpview.StopLoading
If Url.StartsWith("mailto:") Then
message.To.Add(Url.SubString(7))
StartActivity(message.GetIntent)
Else
StartActivity(p.OpenBrowser(Url))
End If
End Sub