New newb need some guidance

wolfray99

New Member
Hello to all.

I am a pretty known with vb2008 and 10.

today i started with basic4android.

Awsome program may i add :)

But heres my question.

If i would like to sign up on a webpage. and want a browser or webpage in my app. how would i start.

i know how to do this in VB but is it almost the same as in B4A??

thnx in advance

Edit NVM i found it :)

toke me 6 hours but he lol..
 
Last edited:

alfcen

Well-Known Member
Licensed User
Longtime User
B4A provides a webview, which, if placed on an activity, can load any local or remote URL (plus HTML files). It is actually more straightforward than in VB.
 
Upvote 0

wolfray99

New Member
yeah but how bout get elemetby id? or tag?

cant find that..

:(

I would like to load a webpage in the back and get some info from that website into a label or a listview.

How to do that in B4A?
 
Last edited:
Upvote 0

warwound

Expert
Licensed User
Longtime User
You can load a webpage into a WebView and then execute javascript in that webpage - you can execute getElementById() etc.

You execute javascript by inserting it into the webpage using the WebView LoadUrl() method, instead of passing a url to load you pass a String of javascript commands such as "javascript:alert('Hello World');".

The webpage javascript can also call B4A Sub - for this you need to use WebViewExtras and it's addJavascriptInterface() method.
(WebViewExtras also has an executeJavascript() method that is a shortcut to using the WebView LoadUrl method to execute javascript).

By executing javascript and getting that javascript to call a B4A Sub you can get the webpage to send itself (the HTML content) to your B4A code, take a look here: http://www.b4x.com/forum/basic4andr...9408-read-content-html-string.html#post111864.

If however you want to get the webpage HTML and parse it - get data that you can use in a label or ListView - without using a WebView then you need to use the Http library, there's the HttpUtils2 module that wraps most of the Http library and makes it eaier to use.
For info on HttpUtils2 take a look here: http://www.b4x.com/forum/basic4andr...web-services-now-even-simpler.html#post109068.

Martin.
 
Upvote 0
Top