Reputation: 43
I am trying to get current html page path from "asset" folder in cordova android app, when we changing the pages inside the cordova webview.
I am using only MainActivity
public class MainActivity extends CordovaActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
loadUrl(launchUrl);
}}
I searched and tried my level best to find the solution. But still now I cannot get the right solution. I am totally confused, Please suggest any solution for the followings,
Upvotes: 2
Views: 1534
Reputation: 53301
You can get the current url with
appView.getUrl();
To get url changes you can use this:
SystemWebView wv = (SystemWebView)appView.getView();
wv.setWebViewClient(new SystemWebViewClient((SystemWebViewEngine)appView.getEngine()){
public boolean shouldOverrideUrlLoading(WebView view, String url) {
// you can get the current url with view.getUrl()
// or the url that it's trying to load next with url
return false;
}
});
Upvotes: 3