Android Question I want create a simple Webview APP

leonardo pino

Member
Licensed User
Longtime User
Hello, I would like to make a very simple application that shows me a page, I think it´s a webview.
I downloaded some examples (WebviewExtras), but android shows me that the app is outdated.
thanks,
Leonardo.
 

William Lancee

Well-Known Member
Licensed User
Longtime User
Many examples have the same package name "b4a.example" look under Project -> configuration.
When you try to run a earlier dated "b4a.example" on a device that has already a "b4a.example" installed you get the "outdated" message.
The solution is to rename the package of the example you're interested in "b4a.example" => "b4a.wvexample1" or anything else that makes sense to you.

Note that the name has to be lowercase and no spaces and at least two parts xxx.zzzz!
 
Last edited:
Upvote 0

josejad

Expert
Licensed User
Longtime User
(WebviewExtras)
It's easier than that. Just create a new project:
- Open designer, and add a view->Webview
- Press with the right button over the just created webview, and choose "Generate member", and create Dim Webview1 as Webview
- Save the layout, back to your project and add:
B4X:
Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("YourLayout")
    WebView1.LoadUrl("www.google.es")
End Sub

And that's all!!

 
Last edited:
Upvote 0

leonardo pino

Member
Licensed User
Longtime User
Hi,
I have followed Jose's instructions, and everything has worked correctly. I have added a couple of lines to make it look better.

B4X:
Sub Activity_Create(FirstTime As Boolean)

    Activity.LoadLayout("Layout1") ' Cargamos el Designer

    WebView1.Width = 100%x

    WebView1.Height = 100%y

    WebView1.LoadUrl("https://my.page")

End Sub

this worked perfectly when i tried it with the B4Bridge.

But when I copy, rename, and use the apk file inside the objects folder, and install it file on my phone directly, it shows me the message:
"Waiting for ID debugger to connect", then the black screen remains and the page is not displayed.
how should i create the apk file?

Thanks a lot,

Leo
 
Last edited:
Upvote 0

GGSoft

Member
Licensed User
Longtime User
read_the_manual.png


Choose one of the two last options.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
I have followed Jose's instructions, and everything has worked correctly. I have added a couple of lines to make it look better.

Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Layout1") ' Cargamos el Designer
WebView1.Width = 100%x
WebView1.Height = 100%y
WebView1.LoadUrl("https://my.page")
End Sub
Two mistakes:
1. You should add code tags when posting.
2. You should learn how to use anchors with the designer and remove that code.

is it just as simple with B4i?
Yes.
 
Upvote 0
Top