Thommy
Thommy

Reputation: 5417

Fill a HTML5 List with data from Android/Java Code

i want to populate a List in an HTML5 File (displayed within a WebView) with data from Android Code (for exmaple from an ArrayList). Can anyone please tell me how or if this is possible.

Thanks in advance Thommy

Upvotes: 0

Views: 470

Answers (2)

Juliano
Juliano

Reputation: 2562

Read this:

http://developer.android.com/guide/webapps/webview.html#BindingJavaScript

You can expose anything from your Android code. If you return some JSON (array or object), you can build your list (or anything else) using some javascript.

Upvotes: 1

Ferdau
Ferdau

Reputation: 1558

With a WebView you can simply:

webview.loadUrl("javascript:YOURJAVASCRIPTCODE");

Your javascript code could be something like:

document.getElementById('txtField1').value = "test";

Upvotes: 1

Related Questions