shouldOverrideUrlLoading不工作 [英] shouldOverrideUrlLoading is not working

查看:515
本文介绍了shouldOverrideUrlLoading不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序, shouldOverrideUrlLoading ()不叫上4.0.3版本。我已经测试了2.2和4.0.1和他们都工作正常。
设备名称为 HTC Verizon公司

In my application, shouldOverrideUrlLoading() is not called on 4.0.3 version. I have tested it on 2.2 and 4.0.1 and they all are working fine. Device name is HTC verizon.

我的意图是提供邮寄地址自定义活动:与联系电话:链接在页面present。我如何可以使这个工作,如果shouldOverrideUrlLoading()永远​​不会打任何想法?

My intent is to provide custom activities for mailto: and tel: links present in the page. Any ideas on how I can make this work if shouldOverrideUrlLoading() is never hit?

请提示

推荐答案

Autoexplicative方法,你应该重写onPageStarted太:

Autoexplicative method, you should override onPageStarted too:

@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
    super.onPageStarted(view, url, favicon);

    // 11 = Build.VERSION_CODES.HONEYCOMB (Android 3.0)
    if (Build.VERSION.SDK_INT < 11) {

    // According to this page:
    //
    // http://www.catchingtales.com/android-webview-shouldoverrideurlloading-and-redirect/416/
    //
    // shouldOverrideUrlLoading() is not called for redirects on
    // Android earlier than 3.0, so call the method manually.
    //
    // The implementation of shouldOverrideUrlLoading() returns
    // true only when the URL starts with the callback URL and
    // dummyCallbackUrl is true.

         if (shouldOverrideUrlLoading(view, url)) {
             view.stopLoading();
         }
     }
 }

这篇关于shouldOverrideUrlLoading不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆