mask mask - 1 year ago 292
Android Question

Any way to grab a logo icon from website URL, programmatically?

I am in the process of creating an activity where I will show the list of website visited with its logo and its alias name chosen by user.


  • Recent Websites Visited

    logo1 website1/alias name

    logo2 website2/alias name


    . so no

The question is, (Ref. attached image) How to get website logo displayed on left side of http://?

Like below I want to just grab the icon and save it locally

Answer Source

It's called a favicon, and all you have to do is:

  1. If there's an icon at /favicon.ico, use that.
  2. Otherwise, get the content of the page, and extract the location from <link rel="shortcut icon" href="URL goes here" />. You’ll need to use an HTML parser and find the <link> with a rel of either icon or shortcut icon.
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download