I have a android app that has built using ionic and i have used xwalk web-view in it. I need to catch page finished loading event inside my MainActivity.java
which extends the CordovaActivity
class and then perform some action. How i can do this.
Catch "page finished loading" event and do something in ionic/cordova MainActivity.java with xwalk webview
2.1k Views Asked by HarshaXsoad At
3
There are 3 best solutions below
1

If you are using android WebView, please check out the onPageFinished()
method.
http://developer.android.com/reference/android/webkit/WebViewClient.html#onPageFinished(android.webkit.WebView, java.lang.String)
1

If you are using xwalkview in Crosswalk Embedded Mode, its API XWalkResourceClient#onLoadFinished can be useful to you. The detail is here API_docs, you can use like this:
class ResourceClient extends XWalkResourceClient {
public ResourceClient(XWalkView xwalkView) {
super(xwalkView);
}
public void onLoadStarted(XWalkView view, String url) {
super.onLoadStarted(view, url);
Log.d(TAG, "Load Started:" + url);
}
public void onLoadFinished(XWalkView view, String url) {
super.onLoadFinished(view, url);
Log.d(TAG, "Load Finished:" + url);
}
public void onProgressChanged(XWalkView view, int progressInPercent) {
super.onProgressChanged(view, progressInPercent);
Log.d(TAG, "Loading Progress:" + progressInPercent);
}
}
mXWalkView.setResourceClient(new ResourceClient(mXWalkView));
mXWalkView.load("http://www.google.com/", null);
the process event quite similar to Android Webview try this
take care