How to connect to my http://localhost web server from Android Emulator
The localhost refers to the device on which the code is running, in this case the emulator. If you want to refer to the computer which is running the Android simulator, use the IP address 10.0.2.2 instead. You can read more from here.