开发者

Localhost on Nexus One/Android

If开发者_Go百科 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?


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.


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


Connect via USB and point the nexus one browser to 10.0.2.2

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜