@Override
  protected void onResume() {
    super.onResume();

    mSession.getDataHandler().getRoom(mRoom.getRoomId()).addEventListener(mEventListener);
  }
  public static void goToOneToOneRoom(
      final MXSession aSession,
      final String otherUserId,
      final Activity fromActivity,
      final ApiCallback<Void> callback) {
    // sanity check
    if (null == otherUserId) {
      return;
    }

    // check first if the 1:1 room already exists
    MXSession session = (aSession == null) ? Matrix.getMXSession(fromActivity, null) : aSession;

    // no session is provided
    if (null == session) {
      // get the default one.
      session = Matrix.getInstance(fromActivity.getApplicationContext()).getDefaultSession();
    }

    // sanity check
    if ((null == session) || !session.isActive()) {
      return;
    }

    final MXSession fSession = session;

    // so, list the existing room, and search the 2 users room with this other users
    String roomId = null;
    Collection<Room> rooms = session.getDataHandler().getStore().getRooms();

    for (Room room : rooms) {
      Collection<RoomMember> members = room.getMembers();

      if (members.size() == 2) {
        for (RoomMember member : members) {
          if (member.getUserId().equals(otherUserId)) {
            roomId = room.getRoomId();
            break;
          }
        }
      }
    }

    // the room already exists -> switch to it
    if (null != roomId) {
      CommonActivityUtils.goToRoomPage(session, roomId, fromActivity, null);

      // everything is ok
      if (null != callback) {
        callback.onSuccess(null);
      }
    } else {
      session.createRoom(
          null,
          null,
          RoomState.VISIBILITY_PRIVATE,
          null,
          new SimpleApiCallback<String>(fromActivity) {

            @Override
            public void onSuccess(String roomId) {
              final Room room = fSession.getDataHandler().getRoom(roomId);

              room.invite(
                  otherUserId,
                  new SimpleApiCallback<Void>(this) {
                    @Override
                    public void onSuccess(Void info) {
                      CommonActivityUtils.goToRoomPage(
                          fSession, room.getRoomId(), fromActivity, null);

                      callback.onSuccess(null);
                    }

                    @Override
                    public void onMatrixError(MatrixError e) {
                      if (null != callback) {
                        callback.onMatrixError(e);
                      }
                    }

                    @Override
                    public void onNetworkError(Exception e) {
                      if (null != callback) {
                        callback.onNetworkError(e);
                      }
                    }

                    @Override
                    public void onUnexpectedError(Exception e) {
                      if (null != callback) {
                        callback.onUnexpectedError(e);
                      }
                    }
                  });
            }

            @Override
            public void onMatrixError(MatrixError e) {
              if (null != callback) {
                callback.onMatrixError(e);
              }
            }

            @Override
            public void onNetworkError(Exception e) {
              if (null != callback) {
                callback.onNetworkError(e);
              }
            }

            @Override
            public void onUnexpectedError(Exception e) {
              if (null != callback) {
                callback.onUnexpectedError(e);
              }
            }
          });
    }
  }
  @Override
  protected void onPause() {
    super.onPause();

    mSession.getDataHandler().getRoom(mRoom.getRoomId()).removeEventListener(mEventListener);
  }