Hello,
I am trying to override a mailto: in the URL for a WebView. I have included my small test program below. Each time I run this, with either 1.7 or 1.8 just after the StartActivity I get a Force Close, but the default e-mail client does open. Am I doing something simple wrong?
Thanks,
Barry.
I am trying to override a mailto: in the URL for a WebView. I have included my small test program below. Each time I run this, with either 1.7 or 1.8 just after the StartActivity I get a Force Close, but the default e-mail client does open. Am I doing something simple wrong?
B4X:
'Activity module
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.
Dim LayVal As LayoutValues
Dim wv1 As WebView
End Sub
Sub Activity_Create(FirstTime As Boolean)
Dim s As String
LayVal = Activity.LoadLayout("l1")
wv1.Left = 0
wv1.Top = 0
wv1.Width = 100%x
wv1.Height = 100%y
s = File.GetText(File.DirAssets, "fsHlp.html")
wv1.LoadHtml(s)
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub wv1_OverrideURL (Url As String)
'
' The URL is: mailto:[email protected]?Subject=MyTest
'
If (Url.IndexOf("mailto:") > -1) Then
Dim Intent1 As Intent
Intent1.Initialize(Intent1.ACTION_VIEW, Url)
StartActivity(Intent1)
Return(True)
End If
End Sub
Thanks,
Barry.