運行我寫它適用於Android 2.2 API的代碼,但它並沒有在Android 4.0安卓:HttpClient的不Android 4.0的API
String url = textUrl.getText().toString();
HttpClient client = new DefaultHttpClient();
HttpGet request = new HttpGet(url);
try
{
HttpResponse response = client.execute(request);
textResult.setText(HttpHelper.request(response));
}
catch (Exception e) {
// TODO: handle exception
textResult.setText("Failed");
}
你會得到什麼樣的錯誤? – fiddler
它生成異常,我沒有得到從URL的迴應 –
你的代碼在哪裏?如果在Activity的'onCreate()'中,然後使用'AsyncTask' .. – user370305