At this time, if our scheme is written in a position other than the first page, an error will appear. This error, I think, is due to the conflict between the previous url and the url of the jump Activity. The method to deal with this situation is as follows:
In WebView, override shouldOverrideUrlLoading method in WebViewClient class, the specific code is as follows
In WebView, override shouldOverrideUrlLoading method in WebViewClient class, the specific code is as follows
@Override
public boolean shouldOverrideUrlLoading(WebView view, String httpurl) {
if (httpurl.startsWith("scheme:") || httpurl.startsWith("scheme:")) {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(httpurl));
startActivity(intent);
}
return false;
}
The
method is, as long as the url starts with scheme, we jump to the url. So we solved…