@Override
  public void onBackPressed() {
    if (isStickersFrameVisible) {
      setStickersFrameVisible(false);
      stickerButton.setImageResource(R.drawable.ic_action_insert_emoticon);
    } else {
      try {
        chat.release();
      } catch (XMPPException e) {
        Log.e(TAG, "failed to release chat", e);
      }
      super.onBackPressed();

      Intent intent = new Intent(ChatActivity.this, BusinessDetailsActivity.class);
      startActivity(intent);
      finish();
    }
  }
  private void sendChatMessage(String messageText) {
    QBChatMessage chatMessage = new QBChatMessage();
    chatMessage.setBody(messageText);
    chatMessage.setProperty(PROPERTY_SAVE_TO_HISTORY, "1");
    chatMessage.setDateSent(new Date().getTime() / 1000);

    try {
      chat.sendMessage(chatMessage);
    } catch (XMPPException | SmackException.NotConnectedException e) {
      Log.e(TAG, "failed to send a message", e);
    }

    messageEditText.setText("");

    if (dialog.getType() == QBDialogType.PRIVATE) {
      showMessage(chatMessage);
    }
  }