How can I extract this variable bellow from a website to my android code?
I guess it should work using javascript interface but how do I get it?
<script type="text/javascript">
var Ids = "[4161, 104, 121, 202, 1462]";
</script>
And I can’t change the code on the website to a method that returns the value.
Any suggestions?
You can use the
javascript:scheme in a webview.loadurl call. It will execute the javascript in the webview page.From there you can make it call a function in your javascript interface.
Android being the name space used to declare your javascript interface.
Beware that javascriptinterface only work with primitive types. So you actually can’t pass directly an array. Just use the javascript scheme to loop through your array. I see it is not really an array so you should be fine with just :