第一頁 返回 繼續 最後一頁 概覽 圖形
JavaScrip call Java Objects
Make java objects Javascript callable
webview.addJavascriptInterface(Object, String)
- After addJavascriptInterface, this webpage must be
load or reload to enable this object
- The javascript functions in WebView are run on
another threads, so use runOnUiThread to update UI
After API 17, use
import android.webkit.JavascriptInterface;
Before methods export to javascript add
@JavascriptInterface