Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6030527
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T05:02:58+00:00 2026-05-23T05:02:58+00:00

Actually I know how to start the market app by URL filtering with my

  • 0

Actually I know how to start the market app by URL filtering with my custom webview client, but I want to make it more generic, that is to check each URL, not only the market url, but also some other url protocol that the webview would not know how to deal with it, and start the ACTION_VIEW intent to handle that.

I thought maybe I can check if the url is not started with “http” “https” “ftp” “mailto”, if the url is in these protocol, the webview can handle it by itself, for others, I will start a new Intent to try to handle that.

What is your idea? am I correct? any missing protocol that webview could handle?

    webView.setWebViewClient(new WebViewClient() {
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            if (url != null && url.contains("://") && url.toLowerCase().startsWith("market:")) {
                try {
                    view.getContext().startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
                    return true;
                } catch (Exception ex) {
                }
            }
            view.loadUrl(url);
            return true;
        }
    });
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T05:02:59+00:00Added an answer on May 23, 2026 at 5:02 am

    One approach you could try is to take a look at PackageManager.queryIntentActivities(Intent, int). This method gives you info for all of the activities that can handle a given Intent. You could simply create an Intent and see what it returns. If you want to have your WebView take priority when it can handle the URL, you could optionally handle any results which include the browser activity. I haven’t tried this code, but it might look something like:

    webView.setWebViewClient(new WebViewClient() {
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
    
            List<ResolveInfo> infos = getPackageManager().queryIntentActivities(intent, 0);
    
            if (infos.size() == 0) {
                // apparently nothing can handle this URL
                return false;
            }
    
            for (ResolveInfo info : infos) {
                if (info.activityInfo.packageName.equals("com.android.browser")) {
                    view.loadUrl(url);
                    return true;
                }
            }
    
            startActivity(intent);
            return true;
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Well I don't actually want to make a calendar but I need a view
I have actually discovered my problem but I am really want to know why
What is actually the different between those start processes ? I know the simple
An Android mobile actually does know quite well where it is - but is
I want to know what actually happens when you annotate a method with @Transactional
I don't know if variadic is actually the right word, but I'm talking about
I'm trying to improve myself with generics but actually I dont know how to
First: apologies for the question title, I don't actually know what the problem is
2 Questions actually: I know i must use Stored Procedures as much as Possible,
I know it sounds and actually is stupid. I am trying to promote my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.