
public void joinRoom(final String roomName) {
// this creates a result bound to 'onJoinRoom' event, that will be
// set in 'CLOSED' state when that event is received, if the matcher
// is satisfied; in this case, the matcher is allways satisfied,
// so any 'onJoinRoom' event will pass
OperationResult operationResult = getOperationResultFactory()
.withMatcher(SFSEvent.onJoinRoom, new TautologyEventMatcher())
.create();
getSmartFoxClient()
.joinRoom(roomName, DEFAULT_ROOM_PASSWORD,
DEFAULT_IS_EXPECTATOR, DEFAULT_DONT_LEAVE,
getCurrentRoomId(getSmartFoxClient());
// blocks until a 'onJoinRoom' event is received;
// if success is not true, throws an exception
waitForEvent(operationResult);
// HERE is the problem, sometimes the user list in current room
// is empty, so I get a NullPointerException and as far as I am
// concerned, it should be automatically updated as the 'onJoinRoom'
// event has already been received
getSmartFoxClient().setUserVariables(
createParameters(getAvatarId(), getUserIdAsString()));
}

Return to Java2SE / Android Client API
Users browsing this forum: No registered users and 1 guest