I'm trying to get the IP address of a computer(or Raspberry Pi) from its hostname from an Android App using InetAddress,The problem is when i type "www.google.com" for example it works but when I try "PC****" which is my PC hostname (got it from the cmd command hostname) it doesn't work Please Help me
public void SearchMachines(View v) {
String netAddress = null;
TextView localTextView = (TextView)findViewById(R.id.tvScaned);
try
{
netAddress = new NetTask().execute("www.google.com").get();
localTextView.setText("Address: " + netAddress);
}
catch (Exception e1)
{
e1.printStackTrace();
}
}
public class NetTask extends AsyncTask<String, Integer, String>
{
@Override
protected String doInBackground(String... params)
{
InetAddress addr = null;
try
{
addr = InetAddress.getByName(params[0]);
}
catch (UnknownHostException e)
{
e.printStackTrace();
}
return addr.getHostAddress();
}
}
![Here is Logcat][1]