WebViewClient を追加します。これにより、デフォルトのブラウザーが URL を開くことができなくなります (または、デフォルトがない場合は選択ダイアログが表示されます)。
myWebView.setWebViewClient(new WebViewClient());
詳細については、Android Web サイト ( http://developer.android.com/guide/webapps/webview.html ) を参照してください。
WebViewClient を使用すると、URL の読み込みを防止したり、URL を変更したりするなど、より多くのことができます。
private class MyWebViewClient extends WebViewClient {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
if (Uri.parse(url).getHost().equals("www.example.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
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
startActivity(intent);
return true;
}
}