Reprinted: http://weizhulin.blog.51cto.com/1556324/311704
Do you want to try using the android simulator to access your own web site? Next I will explain how to implement it.
Step 1: I use Tomcat as the local server. In the webapps directory, put my web project named kankong in and start the Tomcat server.
Enter http: // localhost (or 127.0.0.1): 8080/kankong/index.html in the browser. The following page is displayed:
Step 2: Start the android simulator:
If you have already started the android simulator in eclipse, skip this step. How can we manually start the android simulator?
First, run cmd to display our favorite black screen. Enter Android list AVD (list all AVD simulators)
Then we select one of them to start Android 1.5 as an example: emulator-Debug avd_config-AVD Android 1.5:
The image we are familiar with is as follows:
Step 3: Open the browser and enter http: // localhost: 8080/kankong/index.html?
Our first thought was to input http: // localhost: 8080/kankong/index.html, but this would not succeed. Why? The problem is that the android simulator uses itself as the localhost, that is,CodeAccess using localhost or 127.0.0.1! This cannot be done!
If you want to access your computer on the simulator, use the built-in Android IP address 10.0.2.2. 10.0.2.2 is the specific IP address set by the simulator and is the alias of your computer. Remember, use 10.0.2.2 to access your computer on the simulator.
That is, enter http: // 10.0.2.2: 8080/kankong/index.html to display the following interface:
OK ~ This is all done!
This article is from the "android_tutor" blog, please be sure to keep this http://weizhulin.blog.51cto.com/1556324/311704