Fco
Fco

Reputation: 21

Localhost on Nexus One/Android

If I plug the Nexus One to my computer via USB, is there a way for me to see http://localhost from the computer in the Nexus One screen?

Upvotes: 2

Views: 1637

Answers (3)

gav
gav

Reputation: 29122

Connect via USB and point the nexus one browser to 10.0.2.2

Upvotes: 0

davidosomething
davidosomething

Reputation: 3437

Besides

a) joining the network and visiting the ip of that computer (proposed by zneak) or b) serving the files on the computer

you can also use one of Android's webserver apps (e.g. http://code.google.com/p/i-jetty/ among others) to host a local webserver on Android and just sync that with your localhost

If you're trying to develop a mobile webapp and want to see what it looks like in Android, I would push it to a private live server, or use the (very slow) Android emulator provided by Google

Upvotes: 0

zneak
zneak

Reputation: 138231

localhost is the name given to the current machine. Consequently, browsing to localhost on your Nexus One would browse to your phone's most likely inexistant webserver.

Plugging it with an USB cable will not help, unless you can share your local network connection from your computer to your phone through it. You need to get your phone on your local network and browse to your computer's IP address.

Upvotes: 3

Related Questions