I want to make a http request with android.
is use this:
void testHTTP()
{
HttpClient httpClient = new DefaultHttpClient();
HttpUriRequest request = new HttpPost("http://www.google.com");
try {
HttpResponse response = httpClient.execute(request);
//System.out.println("response protocol version: " + response.getProtocolVersion());
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
I have the internet permission set in my manifest file.
I keep getting java.net.UnknownHostException: www.google.com
My final purpose ios to be able to invoke a web service. So, I initially tried the ksoap2 library and the proper url and got the same result.
I suspect I have some bad setting either in my app or in my emulator.
can you give me some pointers on where to look?
it would also bee useful a working example of something similar. then i could check and if the problem persists i would know that is my development setup at fault.
btw, i am using mac snow leopard with eclipse and android 2.2 as a setup
thanks
regards