private void send(HashMap<String, String> content) {
    HashSet<MMXUser> recipients = new HashSet<>();
    recipients.add(new MMXUser.Builder().username(mUser.getUsername()).build());

    String messageID =
        new MMXMessage.Builder()
            .content(content)
            .recipients(recipients)
            .build()
            .send(
                new MMXMessage.OnFinishedListener<String>() {
                  public void onSuccess(String s) {
                    //                        Toast.makeText(ChatActivity.this, "Message sent.",
                    // Toast.LENGTH_LONG).show();
                  }

                  public void onFailure(MMXMessage.FailureCode failureCode, Throwable e) {
                    Log.e(TAG, "send() failure: " + failureCode, e);
                    Toast.makeText(
                            ChatActivity.this, "Exception: " + e.getMessage(), Toast.LENGTH_LONG)
                        .show();
                  }
                });
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_chat);

    if (MMX.getCurrentUser() == null) {
      MMX.unregisterListener(mEventListener);
      MMX.logout(null);
      Intent intent = new Intent(ChatActivity.this, LoginActivity.class);
      startActivity(intent);
    }

    mUser = getIntent().getParcelableExtra("User");

    MMX.registerListener(mEventListener);
    S3UploadService.init(this);
    mGPS = new GPSTracker(this);

    ActionBar ab = getActionBar();
    if (ab != null) {
      ab.setTitle("Chatting With: " + mUser.getUsername());
    }

    rvMessages = (RecyclerView) findViewById(R.id.rvMessages);
    etMessage = (EditText) findViewById(R.id.etMessage);
    btnSendText = (ImageButton) findViewById(R.id.btnSendText);
    btnSendPicture = (ImageButton) findViewById(R.id.btnSendPicture);
    btnSendLocation = (ImageButton) findViewById(R.id.btnSendLocation);
    btnSendVideo = (ImageButton) findViewById(R.id.btnSendVideo);

    messageList = new ArrayList<>();
    adapter = new MessageRecyclerViewAdapter(this, messageList);

    rvMessages.setAdapter(new SlideInBottomAnimationAdapter(adapter));
    final LinearLayoutManager layoutManager = new LinearLayoutManager(this);
    layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    layoutManager.setStackFromEnd(true);
    layoutManager.setReverseLayout(false);
    rvMessages.setLayoutManager(layoutManager);

    etMessage.setOnKeyListener(
        new View.OnKeyListener() {
          public boolean onKey(View v, int keyCode, KeyEvent event) {
            if ((event.getAction() == KeyEvent.ACTION_DOWN)
                && (keyCode == KeyEvent.KEYCODE_ENTER)) {
              sendMessage();
              return true;
            }
            return false;
          }
        });

    btnSendText.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            sendMessage();
          }
        });

    btnSendPicture.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            selectImage();
          }
        });

    btnSendLocation.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            sendLocation();
          }
        });

    btnSendVideo.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            selectVideo();
          }
        });
  }