How to browse localhost on Android device?

I try to browse localhost on my HTC Magic. I have connected my device with Eclipse via USB. When browsing http://10.0.2.2 I get "Page not available". I remember, some days ago it worked.

But on the emulator I am able to browse localhost

Any ideas?


Easier way to check is in browser of emulator type 10.0.2.2 instead of localhost.


I use my local ip for that i.e. 192.168.0.1 and it works.


to access localhost on emulator: 10.0.2.2. However this may not always work for example if you have something other than a web server such as XMPP server.

assuming that you're on the same wireless network...

  1. find your local ip (should be something 192.168.1.x) - go to the command line and type 'ipconfig' to get this. where x is the assigned local ip of the server machine.

  2. use your local ip for your android device to connect to your localhost.

it worked for me.