Android Question webbrowser

drgottjr

Expert
Licensed User
Longtime User
if you want a browser:
B4X:
    Dim i As Intent
    i.Initialize(i.ACTION_VIEW, "https://www.google.com")
    StartActivity(i)

if you want a webview:
B4X:
dim webview1 as webview
webview.initialize("wv")
activity.addview(webview1,0%x,0%x,100%x,100%y)
webview.loadurl("https://www.google.com")
 
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
How would you do the zoom out so it will fit the screen
normally you add:
B4X:
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
to the <head> region of your html.
you can also use css to set the body width (100%).
this, of course, only works if you're creating your own html content. if you're just using a webview to browse public websites, you should know that 1) the hard work has already been done for you with chrome, and 2) webview is only a subset of a browser. there are functions which work in a real browser that do not work in a webview.

as for webviewsettings, you include the webviewsettings library in your project and initialize it after initializing your webview. (note: this setting is deprecated, so if it still works, it could un-work whenever google updates the view,which is a few times a year). in any case, my understanding is that it is tied to screen density. i believe it would be an effort to ensure a similar viewing experience of your content across devices with varying screen sizes. i do not believe this means you necessarily see the page fitting the screen. i'm pretty sure that is controlled by the instructions mentioned above.

since i don't know what your intentions are regarding webview, there's not much more to say. except a webview is not a browser.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
 
Upvote 0

steele2012

Member
Licensed User
Longtime User
Thanks drgottjr for that info,I thought webview was web browser like in visual studio, learn something new every day
I just want a simple webbrowser to show a webpage from my website for my taxs reports
 
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
have you tried:
B4X:
dim webview1 as webview
webview.initialize("wv")
activity.addview(webview1,0%x,0%x,100%x,100%y)
webview.loadurl("https://www.steele2012website.com/page_with_tax_info.html")   ' <----- real url goes here
what do you get?

can you add:
B4X:
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">

just below the <!DOCTYPE html> header line in your html document?

giving us the url would be nice so we could see for ourselves what it looks like in a webview, but, presumably, you don't want sensitive personal data plastered all over the forum, so i realize that may not be possible. anyway, load the page from your site into a webview, and report back.
 
Upvote 0

steele2012

Member
Licensed User
Longtime User
Thanks mate just the same, i got a bootleg builder with webpage response thast's done the trick
Thanks to all you guys
 
Last edited:
Upvote 0
Top