在phonegap中发送javascript函数

时间:2014-12-31 06:45:27

标签: android cordova

错误

        01:44:12.586: E/CordovaWebView(1611): CordovaWebView: TIMEOUT
        ERROR! 12-31 01:44:12.586: D/Cordova(1611):
        CordovaWebViewClient.onReceivedError: Error code=-6 Description=The
        connection to the server was unsuccessful.
        URL=file:///android_asset/www/index.html 12-31 01:44:12.606:
        D/DroidGap(1611):
        onMessage(onReceivedError,{"errorCode":-6,"url":"file:\/\/\/android_asset\/www\/index.html","description":"The
        connection to the server was unsuccessful."})

的java

        MyPhoneGapActivity.this.sendJavascript("javascript:getMassTimes();");

不工作

        appView.setWebViewClient(new WebViewClient() {
                        public void onPageFinished(WebView view, String url) {
                            MyPhoneGapActivity.this.runOnUiThread(new Runnable() {
                                public void run() { 

                                   // c.sendJavascript("javascript:getMassTimes()");                           

                                    Log.d(TAG, "before MyPhoneGapActivity ");                               
                                    MyPhoneGapActivity.this.sendJavascript("javascript:getMassTimes();");       

                                    Log.d(TAG, "after MyPhoneGapActivity ");
                                }
                            });
                        }
                    });

0 个答案:

没有答案