2
我正在使用cordova 3.3.0。在我的應用程序中,當我點擊返回按鈕時,一旦應用程序啓動,應用程序就會崩潰。Phonegap Android應用程序崩潰,當點擊返回按鈕
我在主要活動中處理了後退按鈕操作,但結果相同。
以下是崩潰。
03-19 14:40:53.254: E/AndroidRuntime(23449): FATAL EXCEPTION: main
03-19 14:40:53.254: E/AndroidRuntime(23449): Process: com.example.example, PID: 23449
03-19 14:40:53.254: E/AndroidRuntime(23449): android.view.WindowManager$BadTokenException: Unable to add window -- token [email protected] is not valid; is your activity running?
03-19 14:40:53.254: E/AndroidRuntime(23449): at android.view.ViewRootImpl.setView(ViewRootImpl.java:536)
03-19 14:40:53.254: E/AndroidRuntime(23449): at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:259)
03-19 14:40:53.254: E/AndroidRuntime(23449): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69)
03-19 14:40:53.254: E/AndroidRuntime(23449): at android.app.Dialog.show(Dialog.java:286) 03-19 14:40:53.254: E/AndroidRuntime(23449): at org.apache.cordova.DroidGap$5.run(DroidGap.java:1038)
03-19 14:40:53.254: E/AndroidRuntime(23449): at android.os.Handler.handleCallback(Handler.java:733)
03-19 14:40:53.254: E/AndroidRuntime(23449): at android.os.Handler.dispatchMessage(Handler.java:95)
03-19 14:40:53.254: E/AndroidRuntime(23449): at android.os.Looper.loop(Looper.java:136) 03-19 14:40:53.254: E/AndroidRuntime(23449): at android.app.ActivityThread.main(ActivityThread.java:5017)
03-19 14:40:53.254: E/AndroidRuntime(23449): at java.lang.reflect.Method.invokeNative(Native Method)
03-19 14:40:53.254: E/AndroidRuntime(23449): at java.lang.reflect.Method.invoke(Method.java:515)
03-19 14:40:53.254: E/AndroidRuntime(23449): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
03-19 14:40:53.254: E/AndroidRuntime(23449): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
03-19 14:40:53.254: E/AndroidRuntime(23449): at dalvik.system.NativeStart.main(Native Method)
在此先感謝
請發表您的代碼。 –
Sid,它的理由是webview多數民衆贊成它。我加載了像\t super.loadUrl(「file:///android_asset/www/index.html」); –
你是否傳遞任何「上下文」? –