Allow all 'market://' links from inside a webview to open Google Play store

后端 未结 3 2081
无人及你
无人及你 2020-12-05 21:57

I have some links in my webview that are market:// links. When my users tap on them, it gives them a page cannot be found error.

How can I allow all links that begin

3条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-05 22:56

     if (url.startsWith("market://")||url.startsWith("vnd:youtube")||url.startsWith("tel:")||url.startsWith("mailto:"))
    {
        Intent intent = new Intent(Intent.ACTION_VIEW); 
        intent.setData(Uri.parse(url)); 
        startActivity(intent);
        return true;
     }    
    

提交回复
热议问题