Android Question How to load the WebView to a specific remote url?

IamTrying

Active Member
Licensed User
I have 2 layout. second layout contain webView. I am trying to tell the WebView to load url but its not opening any site,
showing white empty webView element only.

B4X:
Sub Globals
    Dim btnDownload As Button
    Dim editText1 As EditText
    Dim editText2 As EditText
    Dim editText3 As EditText
    Dim job1 As HttpJob
    Dim parser As JSONParser
    Dim out As OutputStream  
    Dim Intent1 As Intent
    Dim pm As PackageManager  
    Dim WebV As WebView
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Log(">>> Activity_Create")
    Activity.LoadLayout("1")
  
    Intent1 = pm.GetApplicationIntent("io.qt5")
    If Intent1.IsInitialized Then
        readLogin  
    Else
        Msgbox("Please install the primary app.","Sorry")
        toggleFormLogout   
    End If  
End Sub

Sub toggleFormLogout
    Activity.RemoveAllViews
    Activity.LoadLayout("2")  
    WebV.Initialize("WebV")
    'WebV.LoadHtml("<html><body background='file:///android_asset/image.jpg'></body></html>")
    WebV.LoadUrl("https://icanhazip.com")
End Sub
 

DonManfred

Expert
Licensed User
Longtime User
You should not initialize objects loaded with the Designer. Remove
B4X:
 WebV.Initialize("WebV")
from toggleFormLogout
 
Upvote 0
Top