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.
Yes it's possible. This code will show Googles web page:
B4X:
Sub Globals
Dim WebView1 As WebView
WebView1.Initialize("WebView1")
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.AddView(WebView1, 0, 0, Activity.Width, Activity.Height)
WebView1.LoadUrl("http://www.google.com")
End Sub
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
ok I have test this now.
works great.
but one thing is it possible to resize it to only full screen even with 320dpi.
B4X:
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.
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.
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.
You can set WebView to full screen use 100%x to width and 100%y to height
and always put "dip" when indicate values:
B4X:
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