Android Question I need help, with getelementbyid

wolfray99

New Member
Hello to all,

I have a question, I am pretty good with vb2010.

But i just started with b4a.

I want to get information from a website and post it in a label or edittext.

this is the part i want:

B4X:
<span id="Label3" style="font-weight:normal;">GPS Satellites</span>:</td></tr><tr><td colspan="2" align="right"><span id="gpsSatsLbl" style="font-weight:bold;">Tracking 10, Fixing 9</span></td></tr><tr><td colspan="2" style="height:10px;"></td></tr><tr><td colspan="2"><span id="Label4" style="font-weight:normal;">GLONASS Satellites</span>:</td></tr><tr><td colspan="2" align="right"><span id="gloSatsLbl" style="font-weight:bold;">Tracking 8, Fixing 8</span>

En i want too extract the InnerHtml. ( Tracking 10, Fixing 9)

In VB2010 i do this with the following code:

B4X:
Label2.Text = WebBrowser1.Document.GetElementById("gpsSatsLbl").InnerHtml

But this doesnt work, and i tried with the Json and several different examples. but i dont get it to work.

Can anybody give me a example to lets say put the InnerHtml of that ID in a Label1.text.

Best regards

Ray
 

Alberto Iglesias

Well-Known Member
Licensed User
Longtime User
Hello my friend,

DO you have ideia how get the elements of a div? because in this line below I just get "peer"and "peertype"


Dim JO As JavaObject = TJO.RunMethod("getElementById",Array As Object("mydivOnHtml"))

upload_2019-3-28_19-1-48.png




Thank you

Alberto Iglesias
 
Upvote 0
Top