我已经编写了适用于 Android 2.2 API 的代码,但它不适用于 Android 4.0
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");
}