Android Question Extract value from website

DonManfred

Expert
Licensed User
Longtime User
webviewextras is a b4a library. It is the right way to inject javascript.
Search the forum; there are some samples.
You need to know Javascript do write it though.

Webvieextras
 
Upvote 0

catyinwong

Active Member
Licensed User
Longtime User
webviewextras is a b4a library. It is the right way to inject javascript.
Search the forum; there are some samples.
You need to know Javascript do write it though.

Webvieextras

The sample needs Webvieextras2, I have searched the forum but the library seems to be removed?



Found this one: http://b4a.martinpearman.co.uk/webviewextras/WebViewExtras2-20140318.zip

Not Found
The requested URL /webviewextras/WebViewExtras2-20140318.zip was not found on this server.

Apache/2.4.7 (Ubuntu) Server at b4a.martinpearman.co.uk Port 80
 
Upvote 0

catyinwong

Active Member
Licensed User
Longtime User
Have you tried the samples in the link you post?

B4X:
document.getElementById("elementName");

https://www.w3schools.com/jsref/met_document_getelementbyid.asp

That is a sample for B4J which I don't have. So I am looking for one for B4A..

And I tried the following codes:

B4X:
Dim req As HttpRequest         'Set up an http request connection
  
	Dim hc As HttpClient
	Dim PostUrl As String ="http://www.google.com"

    hc.Initialize("")
	req.InitializeGet(PostUrl)

    hc.Initialize("hc")
	hc.Execute(req, 1)

	Wait for hc_ResponseSuccess (Response As HttpResponse, TaskId As Int)         'We got connection and data !!

	Dim resultString As String
	resultString = Response.GetString("UTF8")   'This holds the returned data
    
	Dim wb As WebView
	wb.Initialize("")
	wb.LoadHtml(resultString)
	Response.Release
	Activity.AddView(wb,0,0,100%x,100%y)

Somehow I can't test run for the above code, with the following error when starting the debug:

B4A Version: 8.30
Parsing code. (0.20s)
Compiling code. (1.04s)
Compiling layouts code. (0.06s)
Organizing libraries. (0.00s)
Generating R file. (0.21s)
Compiling debugger engine code. (10.45s)
Compiling generated Java code. Error
B4A line: 154
hc.Initialize(\
javac 1.8.0_171
src\b4a\example\main.java:1779: error: cannot access ClientProtocolException
_hc.Initialize("");
^
class file for org.apache.http.client.ClientProtocolException not found
 
Upvote 0
Top