0

How to get favicon of any website by entering its URL in android. Or there is any program when we enter the URL the program automatically FATCH its icon and we can use these icon further in android studio in java.

TP SINGH
  • 31
  • 1
  • 5
  • duplicate question refer this answer https://stackoverflow.com/a/5119097/8968956 also before posting question search if someone else had the same problem there might be approved answers – trinadh thatakula Jun 25 '22 at 06:27

1 Answers1

1

This is how you can receive the icon of url in android.

WebView webView = new WebView(getActivity());
webView.loadUrl("https://" + url);

webView.setWebChromeClient(new WebChromeClient() {
        @Override
        public void onProgressChanged(WebView view, int newProgress) {
            super.onProgressChanged(view, newProgress);
            progressBar.setProgress(newProgress);
        }

        @Override
        public void onReceivedIcon(WebView view, Bitmap icon) {
            super.onReceivedIcon(view, icon);
            faviconIV.setImageBitmap(icon);
        }
    });