直接代码了
通过

private void sendRequestWithHttpURLConnection()
{
//开启线程发起网络请求
new Thread(new Runnable() {
@Override
public void run() {
HttpURLConnection connection = null;
BufferedReader reader = null;
try {
URL url = new URL("http://ring3.xyz");
connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.setConnectTimeout(5000);
connection.setReadTimeout(5000);
InputStream in = connection.getInputStream();

//读取输入流
reader = new BufferedReader(new InputStreamReader(in));
StringBuilder response = new StringBuilder();
String line;
while((line = reader.readLine()) != null)
{
response.append(line);
}
showResponse(response.toString());
}
catch (Exception e) {
e.printStackTrace();
}
finally {
if (reader != null) {
try{
reader.close();
}
catch (IOException e) {
e.printStackTrace();
}
}
if (connection != null) {
connection.disconnect();
}
}
}
}).start();
}

同时记录下安卓下异步事件分发,如下场景
在子线程中进行UI的操作,比如更新某个文本,由于android的UI交互是线程不安全的,所以界面操作只能在主线程中进行,那么,就要想办法让子线程通知主线程了,可以通过Handler实现
在子线程中构造一个Message,然后通过Handler对象进行通知

new Thread(new Runnable())
{
@Override
public void run()
{
...
Message msg = new Message();
msg.what = x;
handler.sendMessage(msg); //通知
...
}
}
主线程
private Handler handler = new Handler()
{
public void handleMessage(Message msg)
{
xxx
}
}

android中异步消息处理主要由四部分构成
Message 需要传递的信息
Handler 最终处理者
Looper 每个线程一个,负责取消息与分发
MessageQueue 每个线程一个,存放消息队列