@Override
  public boolean onContextItemSelected(MenuItem item) {
    if (item.getItemId() == R.id.delete_message) {
      EMContact tobeDeleteUser =
          adapter.getItem(((AdapterContextMenuInfo) item.getMenuInfo()).position);
      boolean isGroup = false;
      if (tobeDeleteUser instanceof EMGroup) isGroup = true;
      // 删除此会话
      EMChatManager.getInstance().deleteConversation(tobeDeleteUser.getUsername(), isGroup);
      InviteMessgeDao inviteMessgeDao = new InviteMessgeDao(getActivity());
      inviteMessgeDao.deleteMessage(tobeDeleteUser.getUsername());
      adapter.remove(tobeDeleteUser);
      adapter.notifyDataSetChanged();

      // 更新消息未读数
      ((MainTabActivity) getActivity()).updateUnreadLabel();

      return true;
    }
    return super.onContextItemSelected(item);
  }
 /** 刷新页面 */
 public void refresh() {
   adapter =
       new ChatHistoryAdapter(getActivity(), R.layout.row_chat_history, loadUsersWithRecentChat());
   listView.setAdapter(adapter);
   adapter.notifyDataSetChanged();
 }