在我的 phonegap 项目中,我有两个活动,Mainactivity 和 Secondactivity,我为 Mainactivity 编写了一个插件来使用 Intent 启动 Secondactivity。我总是失败并得到一些错误日志:
08-28 12:11:07.298: W/webcore(924): java.lang.Throwable: EventHub.removeMessages(int what = 107) is not supported before the WebViewCore is set up.
08-28 12:11:07.298: W/webcore(924): at android.webkit.WebViewCore$EventHub.removeMessages(WebViewCore.java:1683)
08-28 12:11:07.298: W/webcore(924): at android.webkit.WebViewCore$EventHub.access$7900(WebViewCore.java:926)
08-28 12:11:07.298: W/webcore(924): at android.webkit.WebViewCore.removeMessages(WebViewCore.java:1795)
08-28 12:11:07.298: W/webcore(924): at android.webkit.WebView.sendOurVisibleRect(WebView.java:2917)
08-28 12:11:07.298: W/webcore(924): at android.webkit.ZoomManager.setZoomScale(ZoomManager.java:593)
08-28 12:11:07.298: W/webcore(924): at android.webkit.ZoomManager.access$1700(ZoomManager.java:49)
08-28 12:11:07.298: W/webcore(924): at android.webkit.ZoomManager$PostScale.run(ZoomManager.java:984)
08-28 12:11:07.298: W/webcore(924): at android.os.Handler.handleCallback(Handler.java:605)
08-28 12:11:07.298: W/webcore(924): at android.os.Handler.dispatchMessage(Handler.java:92)
08-28 12:11:07.298: W/webcore(924): at android.os.Looper.loop(Looper.java:137)
08-28 12:11:07.298: W/webcore(924): at android.app.ActivityThread.main(ActivityThread.java:4424)
08-28 12:11:07.298: W/webcore(924): at java.lang.reflect.Method.invokeNative(Native Method)
08-28 12:11:07.298: W/webcore(924): at java.lang.reflect.Method.invoke(Method.java:511)
08-28 12:11:07.298: W/webcore(924): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
08-28 12:11:07.298: W/webcore(924): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
08-28 12:11:07.298: W/webcore(924): at dalvik.system.NativeStart.main(Native Method)
08-28 12:12:06.738: E/CordovaWebView(924): CordovaWebView: TIMEOUT ERROR!
并得到:
CordovaWebViewClient.onReceivedError: Error code=-6 Description=The connection to the server was unsuccessful. URL=file:///android_asset/www//Second.html
如果我使用 codorva 1.8.1 我得到:
08-28 15:13:03.020: W/webcore(29758): java.lang.Throwable: EventHub.removeMessages(int what = 107) is not supported before the WebViewCore is set up.
08-28 15:13:22.850: W/webview(29758): java.lang.Throwable: Warning: A WebView method was called on thread 'Thread-7765'. All WebView methods must be called on the UI thread. Future versions of WebView may not support use on other threads.
这是我的 SecondActivity 代码:
public class Secondactivity extends DroidGap {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.init();
super.setIntegerProperty("loadUrlTimeoutValue", 60000);
super.loadUrl("file:///android_asset/www//Second.html");
}
}
我的 Mainactivity 还扩展了 DroidGap。
谁能给我一些提示?
===============================================我用startActivityForResult替换了startActivity ,这行得通!