Android Phonegap - TIMEOUT ERROR when trying to set a WebViewClient

后端 未结 3 645
再見小時候
再見小時候 2020-12-29 01:02

I\'m working with Android and Phonegap, and at the moment I\'m having trouble with one simple thing. I need to setup a webViewClient to the PhoneGap webView in order to capt

3条回答
  •  情深已故
    2020-12-29 01:29

    I think I've figured this out on latest Cordova versions (I'm using 2.2). It fails at onPageStarted() because it's expecting an appView, which is null. Setting the appView seems to fix it eg

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        super.init();
    
        CordovaWebViewClient webViewClient = new CustomAcceptingWebViewClient(this);
        webViewClient.setWebView(this.appView);
        this.appView.setWebViewClient(webViewClient);
    
        super.loadUrl("file:///android_asset/www/index.html");
    
    }
    

    Note that the super.init() is also needed

提交回复
热议问题