.getUsername());
                    contactList.remove(tobeDeleteUser);
                    contactListLayout.refresh();
                    sendCmdDeleteMsg(toBeProcessUser.getUsername());
                    Toast.makeText(getContext(), "删除成功", Toast.LENGTH_SHORT).show();
                } else {
                    Toast.makeText(getContext(), st2, Toast.LENGTH_SHORT).show();
                }
            }

            @Override
            public void onFailure(String errorMsg) {
                pd.dismiss();
                Toast.makeText(getContext(), st2, Toast.LENGTH_SHORT).show();

            }
        });


//        new Thread(new Runnable() {
//            public void run() {
//                try {
//                    EMClient.getInstance().contactManager().deleteContact(tobeDeleteUser.getUsername());
//                    // remove user from memory and database
//                    UserDao dao = new UserDao(getActivity());
//                    dao.deleteContact(tobeDeleteUser.getUsername());
//                    DemoHelper.getInstance().getContactList().remove(tobeDeleteUser.getUsername());
//                    getActivity().runOnUiThread(new Runnable() {
//                        public void run() {
//                            pd.dismiss();
//                            contactList.remove(tobeDeleteUser);
//                            contactListLayout.refresh();
//
//                        }
//                    });
//                } catch (final Exception e) {
//                    getActivity().runOnUiThread(new Runnable() {
//                        public void run() {
//                            pd.dismiss();
//                            Toast.makeText(getActivity(), st2 + e.getMessage(), Toast.LENGTH_SHORT).show();
//                        }
//                    });
//
//                }
//            }
//        }).start();

    }

    private void sendCmdDeleteMsg(String hxid) {
        EMMessage cmdMsg = EMMessage.createSendMessage(EMMessage.Type.CMD);
        