Reputation: 31
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.
Upvotes: 0
Views: 2270
Reputation: 196
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);
}
});
Upvotes: 2