@Override public void onError(int errorId, HttpRequest request, HttpResponse response) { // TODO runOnUiThread( new Runnable() { public void run() { lstComments.onRefreshComplete(); prgWait.setVisibility(View.GONE); btnMore.setVisibility(View.VISIBLE); } }); Utils.showLog(" on error ", String.valueOf(errorId)); }
@Override public Object dealTheData(HttpResponse response, String data) { // TODO if (this.request.contains("/Client/CommentClientDo.aspx?method=101&arg=")) // 判断是否是添加评论的操作 { if (data.contains("ok")) { Utils.showLog("add comment ok"); edtInputComment.setText(""); runOnUiThread( new Runnable() { @Override public void run() { // TODO Auto-generated method stub Utils.showToast(getApplicationContext(), getString(android.R.string.ok)); } }); } else if (data.contains("fail")) { Utils.showLog("add comment fail "); runOnUiThread( new Runnable() { @Override public void run() { // TODO Auto-generated method stub Utils.showToast(getApplicationContext(), getString(android.R.string.no)); } }); } } else if (this.request.contains( "/Client/CommentClientDo.aspx?method=103&arg=")) // 判断是否是增加阅读次数的操作 { if (data.contains("ok")) { Utils.showLog("incream read ok"); runOnUiThread( new Runnable() { @Override public void run() { // TODO Auto-generated method stub Utils.showToast(getApplicationContext(), "incream read ok"); } }); } else if (data.contains("fail")) { Utils.showLog("incream read fail "); runOnUiThread( new Runnable() { @Override public void run() { // TODO Auto-generated method stub Utils.showToast(getApplicationContext(), "incream read fail"); } }); } } else if (this.request.contains( "/Client/CommentClientDo.aspx?method=102&arg=")) // 获得新闻的评论内容,然后进行解析 { Object obj = null; try { if (data.length() < 3) { page = -1; onError(nomore, null, response); } else obj = Json2Object.parserToNewsComment(data); return obj; } catch (UnsupportedEncodingException e) { // TODO e.printStackTrace(); onError(UnsupportedEncodingException, null, response); } catch (JSONException e) { // TODO e.printStackTrace(); onError(JSONException, null, response); } catch (ParseException e) { // TODO e.printStackTrace(); onError(ParseException, null, response); } } return null; }