[android] Accessing localhost of PC from USB connected Android mobile device

Here is a piece of my Android app's code:

This app is able to communicate with a HTTP get-post model between a servlet running on a server and an Android device plugged in USB-Debuggable mode (because the app was in developing progress).

I also can run the app over Wi-Fi when the server, Tomcat Apache 7, running on (when the app development was finished).

enter image description here

To get the IP address of yours

  1. Go to Command Prompt
  2. Type ipconfig
  3. Hit enter

In the list, IPv4 Address is your IP.