httpclient android
HttpClient hc = new DefaultHttpClient();
HttpPost post = new HttpPost("http://www.yahoo.com.hk");
HttpResponse rp = hc.execute(post);
if(开发者_如何学JAVArp.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
String str = EntityUtils.toString(rp.getEntity());
Log.e("STRING:",str);
}
It is not printing error message also. It is giving launch timeout warning. Give me the code to connect with yahoo or google servers.
Code looks fine. I'm not doing it much different.
it is giving launch timeout warning.
Could it be that you are running this in the UI-thread instead of it's own thread? Do you have the INTERNET-permission in your app? Try adding a log-statement for the ELSE -case too.
精彩评论