Last active
August 29, 2015 14:06
-
-
Save Shebella/f8dacfd23d7673401d7a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
webView.setWebViewClient(new WebViewClient() { | |
@Override | |
public boolean shouldOverrideUrlLoading(WebView view, String url) { | |
if (Uri.parse(url).getScheme().equals("market")) { | |
try { | |
Intent intent = new Intent(Intent.ACTION_VIEW); | |
intent.setData(Uri.parse(url)); | |
Activity host = (Activity) view.getContext(); | |
host.startActivity(intent); | |
return true; | |
} catch (ActivityNotFoundException e) { | |
// Google Play app is not installed, you may want to open the app store link | |
Uri uri = Uri.parse(url); | |
view.loadUrl("http://play.google.com/store/apps/" + uri.getHost() + "?" + uri.getQuery()); | |
return false; | |
} | |
} | |
return false; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
view.loadUrl("http://play.google.com/store/apps/"