Help with WebView

mramos

Member
Licensed User
Longtime User
I am getting the message box, so I know the button is working. But I can not get the webview on the emulator or phone. Tried the .Enable as well. I have a main layout open with my main code.

B4X:
Sub ShowPage_Click
      Webline = "http://www.google.com"
      Msgbox(Webline,"")
      WebView1.BringToFront
      Webview1.Visible=True
      WebView1.LoadUrl(Webline)
End Sub
 

bobsimoneau

Member
Licensed User
Longtime User

I created a quick test using your code, and it worked on the emulator first try. I attached it to this message. I hope it helps.
 

Attachments

  • WebViewPrg.zip
    5.6 KB · Views: 291
Upvote 0

mramos

Member
Licensed User
Longtime User
I created a quick test using your code, and it worked on the emulator first try. I attached it to this message. I hope it helps.

Thanks Bob,

Can not test it at home, B4A will ot run here, will test it when I return to work. Thanks for checking it. I did not get the main.bal, but no problem there.

So it did get rid of the button you had and pulled up google? Did you use back to return and all was good.
 
Upvote 0

bobsimoneau

Member
Licensed User
Longtime User

I can see the main.bal in the zip attachment. It brought up google seconds after I hit the show button, and the return button brought in back to the emulator main screen as it should. Just tried it again, all seems fine.
 
Upvote 0

mramos

Member
Licensed User
Longtime User
Bob,

Does this work for you in the emulator? Anyone else? I can surf with the browser. Looks like webview it in Core, not sure what I am missing.
 

Attachments

  • webviewtest.zip
    5.4 KB · Views: 260
Upvote 0

bobsimoneau

Member
Licensed User
Longtime User
Bob,

Does this work for you in the emulator? Anyone else? I can surf with the browser. Looks like webview it in Core, not sure what I am missing.

It did not work for me. I added a webview to your layout and made it invisible. Then when I pressed the botton. The webview can to the front.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Why aren't you adding the WebView with the designer?
If you want to add it programmatically then you also need to call Activity.AddView and add the WebView.

You should initialize the view only when FirstTime is true. Just remove this check. You should initialize it every time the activity is created.
Only process global objects should be initialized only when FirstTime is true.
 
Upvote 0

mramos

Member
Licensed User
Longtime User

Is there a tutorial on the Webview and how to add it via the designer. I will try to add it hand first and see how it goes.

Thanks
 
Upvote 0

mramos

Member
Licensed User
Longtime User
You add it like any other view. Choose AddView - WebView. You should also choose Tools - Generate members and add the declaration for this object as you will need to reference it by code.

So I can add another .bal and put a webview and generate the Dims? Can I load it in a panel at that point. I like the panels so I have to program but flip up the screens I want.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…