Webrowser app.

Engan

Member
Licensed User
Longtime User
ok is there anyway to display an webpage with B4A.
on start it should load one webpage. then a few buttons that navigate to another webpage. is that possible. and can someone help me with that.
 
Here is a sample:
Code: Copy
Dim MyWebView As WebView
Dim btnwebview As Button

btnwebview.Initialize("btnWebView")
MyWebView.Initialize("")

Activity.AddView(MyWebView,0,50%y,100%x,50%y)
Activity.AddView(btnwebview,0,45%y,50%x,60dip)

Sub btnWebView_Click
   MyWebView.LoadUrl("http://www.Basic4Android.com")
End Sub
 
Upvote 0
ok thanks.
im really new to b4a. have coded allot earlier with VB6.
But want to learn this.
did just bought this today.
 
Upvote 0
ok I have test this now.
works great.
but one thing is it possible to resize it to only full screen even with 320dpi.

Code: Copy
Sub Globals
Dim MyWebView As WebView
Dim btnwebview As Button

btnwebview.Initialize("btnWebView")
MyWebView.Initialize("")
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.AddView(MyWebView,0,0,Activity.Width, Activity.Height-85)
Activity.AddView(btnwebview,0,Activity.Height-80,Activity.Width,85)
btnwebview.Text="Home"
    MyWebView.LoadUrl("http://google.com")
End Sub

Sub btnWebView_Click
    MyWebView.LoadUrl("http://www.Basic4Android.com")
End Sub
it works but it resize to bigger than the screen on 320dpi.
I want it to be muti reso functional.
 
Upvote 0
I'm not sure if I understand this correctly. But, perhaps you could try myWebView.Zoom(false)
 
Upvote 0
ok will test around.
Maybe I need to use the designer and make several layout variants.
but I test you suggestion.
thanks for the help im getting here to learn this stuff.
 
Upvote 0
ok it does not work for me the screen goes blank and the page does not load.
what I want it is to make it work on several devices.
regular phone, Tablet and also on galaxy note that has 800x1280 and scale 2.
many app is screwed on that device and I want it to function on that to.
what happens is that on all screens it works but on the note it being like zoomed so you must drag the screen.
I just only want the page to be viewed full screen not more.
 
Upvote 0
You can set WebView to full screen use 100%x to width and 100%y to height
and always put "dip" when indicate values:
Code: Copy
Sub Globals
Dim MyWebView AsWebView
Dim btnwebview AsButton

End Sub


Sub Activity_Create(FirstTime AsBoolean)

btnwebview.Initialize("btnWebView")
MyWebView.Initialize("")

Activity.AddView(MyWebView,0dip,0dip,100%x, 100%y-90dip)
Activity.AddView(btnwebview,25%x,100%y-87dip, 50%x, 85dip)
btnwebview.Text="Home"
MyWebView.LoadUrl("http://google.com")
End Sub

Sub btnWebView_Click
MyWebView.LoadUrl("http://www.Basic4Android.com")
End Sub
 
Upvote 0
Back
Top