consider the following android code and please solve my problem: There is REST server running on my laptop..i can access that server from my browser and get proper resuts...but now i want to use it from my android emulator that is also running on my laptop using following code..
// String URL = "http://localhost:8080/server/rest/user/1";
String URL = "http://www.google.com";
HttpClient httpclient = new DefaultHttpClient();
HttpGet request = new HttpGet(URL);
HttpResponse result = httpclient.execute(request);
in emulator when i pass the URL as http://www.google.com , i got proper response in result but when i use my localhost url(the commented one above) i got connection refused....
WARN/System.err(901): org.apache.http.conn.HttpHostConnectException: Connection to http://localhost:8080 refused
WARN/System.err(901): Caused by: java.net.ConnectException: /127.0.0.1:8080 - Connection refused
if i run the same url on my browser it works. can you tell me why localhost url is not working in emulator..?