title: Get domain name from URL in Java/Android
body: <p>In my app, I need to get the favicon.ico from a URL. (eg. "<a href="http://google.com/favicon.ico" rel="noreferrer">http://google.com/favicon.ico</a>").
  Users can input all kinds of URLs, and I need only the domain name.</p>
  
  <p>Examples:</p>
  
  <pre><code>http://drive.google.com/bla/bla/bla -&gt; drive.google.com
  
  www.facebook.com/lol -&gt; www.facebook.com
  
  192.168.0.1 -&gt; 192.168.0.1 (but not really necessary)
  </code></pre>
  
  <p>Does anyone have a method to get this?
  Thanks!</p>