B4J Question Problem trying to display a webpage

Peter Lewis

Active Member
Licensed User
Longtime User
Hi All

Yet again I cannot get this right and I do not know why

I setup a webview and already the the initialize ect. Then I made a sub so that I can pass a parameter to it and it will load the webpage. Here is the Sub.

B4X:
Sub ADVERTS(startpages As String)
    Log("Loading "&startpages)
   
    Private startPage As String = "https://www.djpeter.co.za/advert4.jpg"

    we.RunMethod("load",Array As String(startPage))
    Log("loaded")
End Sub

Now I have tried a few different ways.

1. Loading the runmethod with the variable start pages which that variable has the exact string that is shown in startpage variable . Does not work.
2. Changed to Load the Array as Object , Does not work
3. if i change it to use the variable Startpage, it works
4. I tried moving the initialize lines into this sub and no difference


B4X:
we.InitializeNewInstance("javafx.scene.web.WebEngine",Null)
    temp = WebView1
    we = temp.RunMethod("getEngine",Null)

This is now confusing for me , please can someone show me the light.

thank you
 

Peter Lewis

Active Member
Licensed User
Longtime User
I did try that and it loads the URL the first time but in the next loop it still keeps the same URL. I checked the incoming url with a log event and it shows the new url and i cannot find anywhere to clear Webview.

Sorry the previous question about the "" was stupid. Now that I have had some sleep I can see that ...LOL
 
Upvote 0

Peter Lewis

Active Member
Licensed User
Longtime User
I have now made a simple app so display 5 of the pages on Webview. Even if I clear it after the first page, the rest do not appear. It does clear the first page but then nothing else displays.
 

Attachments

  • webviewtest.zip
    1.9 KB · Views: 199
Upvote 0
Top