@Override
public void onCreate(Bundle savedInstanceState) {
super.setBooleanProperty("showTitle", true);
super.onCreate(savedInstanceState);
//creates super.appView and calls setContentView(root) in DroidGap.java
init();
this.appView.clearCache(true);
this.appView.clearHistory();
this.appView.setWebViewClient(new CordovaWebViewClient(this, this.appView) {
@Override
public WebResourceResponse shouldInterceptRequest(WebView view, String url) {
Log.d("DEBUG", "Should intercept request" +url);
//Implement your code
return super.shouldInterceptRequest(view, url);
}
@Override
public void onLoadResource(WebView view, String url) {
Log.d("DEBUG", "onLoadResource" +url);
//Implement your code
super.onLoadResource(view, url);
}
@Override
public void onPageFinished(WebView view, String url) {
Log.d("DEBUG", "On page finished "+url);
//Implement your code
super.onPageFinished(view, url);
}
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
Log.d("DEBUG", "should override url loading "+url);
//Implement your code
return super.shouldOverrideUrlLoading(view, url);
}
});super.loadUrl("file:///android_asset/www/index.html");}
これは API バージョン 9 ~ 17 用です。onLoadResource も追加することが重要です。