在我的phonegap项目中,我有两个活动,Mainactivity和Secondactivity,我使用Intent为Mainactivity写了一个插件来实现lauch Secondactivity。通过我总是faild并得到一些错误日志:
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");
}
}
My Mainactivity也扩展了DroidGap。
任何人都可以给我一些提示吗?
============================================= 我用startActivityForResult替换了startActivity,这有效!
答案 0 :(得分:0)
更改此行。
super.loadUrl("file:///android_asset/www/Second.html");
这里有错误//Second.html
答案 1 :(得分:0)
您必须打开second.html的index.html文件implace并在index.html文件中管理第二个活动