最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

android studio webview intent play google problem - Stack Overflow

programmeradmin0浏览0评论

If there is Google Play in the entered URL, I want it to open from the external market.

If not, I want it to open normally. My code is as follows, where is the error? Can you help me?

my code : private class Myweb extends WebViewClient {

    @Override
    public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request)
    {


        if (request.getUrl().toString().contains("play.google"))
        {
            Intent intent = new Intent(Intent.ACTION_VIEW);
            intent.setData(Uri.parse(request.getUrl().toString()));
            startActivity(intent);

        }else {
            view.loadUrl(request.getUrl().toString());
        }
        return true;

    }

}

if it opens a play market url, I want it to open in chrome browser. no, if it opens another url, I want it to open normally in webview i couldn't find my mistake.

发布评论

评论列表(0)

  1. 暂无评论