@Override public void handleMessage(Message msg) { hideLoadingDialog(pDialog); switch (msg.what) { case Constants.MSG_CONNECTION_UNAVAILABLE: // 客户端与服务器没有连接 new AlertDialog.Builder(mContext) .setTitle(R.string.prompt) .setMessage(R.string.connection_unavailable) .setNegativeButton(android.R.string.cancel, null) .setCancelable(false) .setPositiveButton(android.R.string.ok, null) .show(); break; case Constants.MSG_SEND_ADD_FRIEND_REQUEST: // 发送添加好友的请求 SystemUtil.makeShortToast(R.string.contact_send_add_friend_request_success); break; case Constants.MSG_ALREAD_ADDED: // 提示已添加过了 SystemUtil.makeShortToast(R.string.contact_send_add_friend_request_repeat); break; default: break; } }
@Override protected void onPostExecute(List<User> result) { users.clear(); if (SystemUtil.isNotEmpty(result)) { users.addAll(result); } if (adapter == null) { adapter = new FriendResultAdapter(users, mContext); lvResult.setAdapter(adapter); lvResult.setEmptyView(emptyView); } else { if (lvResult.getEmptyView() == null) { lvResult.setEmptyView(emptyView); } adapter.notifyDataSetChanged(); } hideLoadingDialog(pDialog); }