java - detect if a market:// link is clicked in a webview -


i try execute code after link clicked in webview. normal links http:// managed using shouldoverrideurlloading method , view.loadurl(url);

but links starting market:// redirect googleplay app, doesn't work. loadurl("market://") throws url not found error.

how can detect if market:// link clicked in webview ?

my code:

wvinfo.setwebviewclient(new webviewclient() {          @override         public boolean shouldoverrideurlloading(webview view, string url) {                if (url.startswith("http")) {                     view.loadurl(url);  // works                     return true;               } else if (url.startswith("market:")){         <do special>                   view.loadurl(url); // doesn't work                   return true;               }         }  }); 

you detect if market:// link clicked, code right.

your question how call googleplay app? use intent instead of loadurl:

intent intent = new intent(intent.action_view);  intent.setdata(uri.parse(url));   startactivity(intent); 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -