@Override public void handleMessage(Message message) { if (message.what == 1) { // 更新头像 mAdapter.notifyDataSetChanged(); } else if (message.what == 2) { // 更新图片 HLog.out(TAG, "message.what:" + message.what); mAdapter.notifyDataSetChanged(); } else if (message.what == 10) { // 更新评论 Bundle bundle = message.getData(); Comment xComment = new Comment(); xComment.setR_id(bundle.getInt("nid")); xComment.setUser_id(mUser.getUid()); xComment.setText(bundle.getString("comment")); xComment.setAdd_Time(Integer.parseInt(bundle.getString("time"))); xComment.setNickname(mUser.getNickname()); xComment.setHead_pic(bundle.getString("head_pic")); ArrayList<Comment> cm = data.get(bundle.getInt("position")).getBcomment(); if (cm == null) { cm = new ArrayList<Comment>(); } cm.add(xComment); data.get(bundle.getInt("position")).setBcomment(cm); data.get(bundle.getInt("position")).setI_comment(true); mAdapter.notifyDataSetChanged(); Utils.Toast(mActivity, "温馨提示:", "评论成功!"); } else if (message.what == 1002) { mAdapter.notifyDataSetChanged(); } }
@Override protected void onRestart() { // TODO Auto-generated method stub super.onRestart(); count = 1; data = new ArrayList<NoticeItem>(); try { HLog.out(TAG, data.size()); } catch (Exception e) { e.printStackTrace(); } loadingData(); // 更新数据 }