Skip to content

Instantly share code, notes, and snippets.

@Shebella
Last active August 29, 2015 14:06
Show Gist options
  • Save Shebella/f8dacfd23d7673401d7a to your computer and use it in GitHub Desktop.
Save Shebella/f8dacfd23d7673401d7a to your computer and use it in GitHub Desktop.
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; 
}); 
@DROID1975
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment