我有一个webview,可以加载保存在我的android应用程序的assets文件夹中的html页面。我有一些电话号码,当被点击时,我不希望调用呼叫活动呼叫。我认为编辑清单中的活动权限会有所帮助,但那是长篇大论。
发布于 2012-01-26 19:54:51
嗯,尝试覆盖URL,以防它导致调用,所以返回true或其他任何东西。为此,您需要从WebViewClient创建一个扩展类,并在webview中设置它:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
WebView webView=(WebView)findViewById(R.id.webv);
webView.setWebViewClient(new ImWebViewClient());
//.....
}
class ImWebViewClient extends WebViewClient{
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
//check the url and when it will come with your phone number return true ..
if(url!=null && url.contain("123456789"))
return true;
return false;//means apply other mime type if available, and this may by default cause calling your number...
}
} https://stackoverflow.com/questions/9016964
复制相似问题