Android WebView prevent page reload

前端 未结 2 1045
长发绾君心
长发绾君心 2020-12-21 00:22

I have a Phonegap packaged application that opens a PDF Viewer when a button is pressed. I did it with the FileOpener2 plugin.

When I go back to the application from

相关标签:
2条回答
  • 2020-12-21 00:47

    In android.webkit.WebViewClient onLoadResource callback invoke stopLoading of WebView

    MyWebViewClient extend WebViewClient {
    
    public void onLoadResource (WebView view, String url) {
        if(your condition ){
             view.stopLoading();
        }
    }
    }
    
    0 讨论(0)
  • 2020-12-21 01:06

    Answering my own question, setting the following properties to the only Acivity in AndroidManifest solves the problem. However I have to test it because it could have problems that I don't know:

    android:launchMode="singleInstance"
    android:alwaysRetainTaskState="true"
    

    Cheers!

    Update

    After testing a bug appeared selection a photo in the Gallery with Phonegap Camera plugin that shows "Selection cancelled".

    So after reading https://groups.google.com/forum/#!topic/phonegap/R08vOZNm580 I set:

     android:launchMode="singleTask"
     android:taskAffinity=""
     android:excludeFromRecents="true"
    
    0 讨论(0)
提交回复
热议问题