If you are trying to access a file (PHP or java) residing in your server in your own machine, then
you have to use a specific IP to access it. If it is public, then use the other System’s IP
1. If it is localhost, In Android you use it as
10.0.2.2
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.
2. If you are trying to access from iOS Simulator use can use
http://localhost:8000/your_path
The iOS Simulator uses the host machine network so you should be able to just use localhost or your machines IP address, whichever IP your web service is listening on.
Pingback: How to connect Localhost in your MAC or Windows to your Android Device OR Android Emulator ?