You are trying to access
http://localhost/ from your device or emulator, but your actual web server runs somewhere else. So, for your device this web server is not a localhost.
To make this work, you need to make sure that the device is connected to the same network as your web server, and that the web server is accessible from your device (probable firewall issues, etc.). You then need to find out the IP address of your host inside the network, e.g. 192.168.1.42, and use that IP address in your android code:
// use your valid IP address instead url = new URL("http://192.168.1.42/login.php");
With this connection, the device will look for a provided IP in your network, and access it, if it is available. Also, note that your IP will probably change, so you'll need to figure out how to make it static.
More on accessing localhost from an Android device here.