Androider
Androider

Reputation: 21335

Running Java Code from HTML5/Javascript

I have an app that is perfect for HTML5 except that it needs to execute some java code. I have heard that javascript/html5 can execute java code and get results back but I'm not sure how this is done. Looking for an opensource library for this. Does anyone know if/how this can be done? Please note I am building an HTML5 view but wrapped in a native Android app. So I want to access a Java library that is contained in the native android app from within Javascript.

Upvotes: 0

Views: 804

Answers (1)

mrBorna
mrBorna

Reputation: 1777

Try looking into addJavascriptInterface for android

Adding JavaScript-to-Java interfaces with the addJavascriptInterface(Object, String) method. This lets you bind Java objects into the WebView so they can be controlled from the web pages via JavaScript

Upvotes: 1

Related Questions