,我发现了以下错误:The type new MyWebViewClient(){} must implement the inherited abstract method MyWebViewClient.launchExternalBrowser()
抽象方法没有被拾起
DCWebView.setWebViewClient(new MyWebViewClient() {
public void launchExternalBrowser(String url) {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
startActivity(intent);
}
});
我不明白,因为根据我的代码,我定义的方法。
public abstract class MyWebViewClient extends WebViewClient {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
if (Uri.parse(url).getHost().equals("www.url.com")) {
// This is my web site, so do not override; let my WebView load the page
return false;
}
// Otherwise, the link is not for a page on my site, so launch another Activity that handles URLs
launchExternalBrowser();
return true;
}
public abstract void launchExternalBrowser();
}