Challenge: Supporting Non-HTTP Links Solution


#1

The challenge sounds challenging but the solution is simple:

(PhotoPageFragment.java)

        mWebView.setWebViewClient(new WebViewClient(){
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {

            Uri uri = request.getUrl();
            if(uri.getScheme().equals("http")|| uri.getScheme().equals("https")) {
                return false;
            }else{
                Intent i = new Intent(Intent.ACTION_VIEW,uri);
                startActivity(i);
                return true;
            }
        }
    });

Works only with api 21+