Italian Da B4A a B4I semplice conversione...

francesco paolo lavecchia

Member
Licensed User
Ciao a tutti,

qualcuno potrebbe spiegarmi come posso convertire questo codice?

B4X:
Sub Globals
Dim wv As WebView
End Sub

Sub Activity_Create(FirstTime As Boolean)
wv.Initialize("wv")
wv.LoadUrl("http://www.mysite.net/")
End Sub

Sub wv_OverrideUrl (Url As String) As Boolean
Dim Intent1 As Intent

Sub wv_OverrideUrl (Url As String) As Boolean

Dim Intent1 As Intent

Intent1.Initialize(Intent1.ACTION_VIEW, Url)
Intent1.SetComponent("android/com.android.internal.app.ResolverActivity")
StartActivity(Intent1) 

If Url.StartsWith("https://maps.google.it/?") Then
wv.Back
wv.Forward
Else If Url.StartsWith("https://www.google.com/maps/dir//") Then
wv.Back
wv.Forward 
wv.Forward 
End If
End Sub

Ho provato in questo modo ma, a differenza di B4A, nella routine wv_OvverrideUrl entra una sola volta. Forse dipende dall' app.openurl che annulla la wv_overrideurl?

B4X:
Private Sub Application_Start (Nav As NavigationController)
NavControl = Nav
Page1.Initialize("Page")
Page1.RootPanel.LoadLayout("main")
NavControl.ShowPage(Page1)
wv.LoadUrl("http://www.miosito.it")
End Sub

Sub wv_OverrideUrl (Url As String) As Boolean
App.OpenURL(Url)
End Sub

Grazie
 
Top