Get HostName by IP Address Android
<p>I'm making a simple IP Scanner in Android using Android Studio. I have successfully checked if the host is Alive or dead. But now I also need to get the hostname of a specific IP Address.</p>

<p>I tried the following two methods but they return Ip address not the hostname</p>

<pre><code>InetAddress inetAddr;
    inetAddr = InetAddress.getByName(host.hostname);
    String hostname = inetAddr.getHostName();
    String canonicalHostname = inetAddr.getCanonicalHostName();
</code></pre>

<p>I also read on some forum to edit the host file, but that is not what I want.</p>

<p>Please help</p>

<p>Thanks</p>