标签:
1、用AsyncHttp: 获取AsynHttp的jar包,并加到libs,(ps:可以从http://search.maven.org/这里下载jar);
AsyncHttpClient client = new AsyncHttpClient();
client.get("http://192.168.1.107:8001/loc", new TextHttpResponseHandler() { // 前面那个是网址
@Override
public void onFailure(int i, Header[] headers, String s, Throwable throwable) {
textView.setText("加载失败");
}
@Override
public void onSuccess(int i, Header[] headers, String s) {
textView.setText(s); // s 就是网页的内容
}
});
标签:
原文地址:http://www.cnblogs.com/jetereting/p/4437896.html