80,352
社区成员
发帖
与我相关
我的任务
分享
HandlerThread thread = new HandlerThread("MyThread");
thread.start();
Handler myhandler = new Handler(thread.getLooper()){
@Override
public void handleMessage(Message msg) {
HttpGet request = new HttpGet("http://192.168.1.120/test/list.php");
HttpResponse httpResponse;
JSONObject result =null;
try {
httpResponse = new DefaultHttpClient().execute(request);
String retSrc = EntityUtils.toString(httpResponse.getEntity());
if(retSrc != null)
result = new JSONObject(retSrc);
}catch (JSONException e) {
showDialog(1);
}catch (Exception e) {
e.printStackTrace();
Log.e("HTTP",e.toString());
}
}
};