开发者

Running Java Code from HTML5/Javascript

开发者 https://www.devze.com 2023-03-30 05:46 出处:网络
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 do开发

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 do开发者_Go百科ne. 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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消