Android Question strange webviewextras2 error

Devv

Active Member
Licensed User
Longtime User
how could this code
B4X:
Sub WebViewClient_PageStarted(Url As String, FavIcon As Bitmap)
    If Url.Contains("&id_universalpay_system=1") Then 'bank muscat payment detected (during checkout)
        ImageView_BankMuscatLogo.SetVisibleAnimated(500, True)
    Else if Url.Contains("&id_universalpay_system=2") Then 'Thawani payment detected (during checkout)
        ImageView_ThawaniLogo.SetVisibleAnimated(500, True)
    Else'hide bank muscat and thawani logo when navigating to another webpage
        If ImageView_BankMuscatLogo.Visible Then ImageView_BankMuscatLogo.SetVisibleAnimated(200, False)
        If ImageView_ThawaniLogo.Visible Then ImageView_ThawaniLogo.SetVisibleAnimated(200, False)
    End If
    
    If Url <> "https://beisat.com/" & Starter.language & "/login?back=my-account" Or Url <> "https://beisat.com/" & Starter.language & "/my-account" Then
        If ImageView_settings.Visible Then ImageView_settings.SetVisibleAnimated(100, False)
    End If
    
    LogColor(Url, Colors.Green)
    
    javascript 'hide header elements and cart items count
End Sub

trigger this error !




note line 111 is
B4X:
Sub WebViewClient_PageStarted(Url As String, FavIcon As Bitmap)


any help is highly appreciated
 

Devv

Active Member
Licensed User
Longtime User
try
B4X:
Sub WebViewClient_PageStarted(Url As String, FavIcon As Object)
dim ficon as bitmap = FavIcon
' work with ficon
end sub

seems to work !

can you please explain why we needed to declare it as an object ?

i was using the event from the documentation , it is by default as bitmap
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
probably because the b4a Bitmap is different to the bitmap Object from Android. B4A Bitmap is a wrapper.
Defining the sub signature as FavIcon As Object takes the parameter (whatever it is).
the next line then creates a wrapperobject and passes the Android Bitmap (encapsulated in the Object).
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…