I try to get Room info related with login user with QuickBlox
sdk. I edited chat sample app and try to grab room info according to this => http://www.igniterealtime.org/builds/smack/docs/latest/documentation/extensions/index.html
MultiUserChat.getRoomInfo, MultiUserChat.getJoinedRooms are not worked ! Connection is successful.NullPointer
exception occur in Iterator<String> joinedRooms = MultiUserChat.getJoinedRooms(connection, "732374-5996@chat.quickblox.com");
public class MyChatController {
// ================= QuickBlox ===== Step 8 =================
// Get QuickBlox chat server domain.
// There will be created connection with chat server below.
public static final String CHAT_SERVER = QBChat.getChatServerDomain();
private XMPPConnection connection;
private ConnectionConfiguration config;
private Chat chat;
private String chatLogin;
private String password;
private String friendLogin;
private ChatManager chatManager;
public MyChatController(String chatLogin, String password) {
this.chatLogin = chatLogin;
this.password = password;
}
public void startChat(String buddyLogin) {
this.friendLogin = buddyLogin;
new Thread(new Runnable() {
@Override
public void run() {
// Chat action 1 -- create connection.
Connection.DEBUG_ENABLED = true;
config = new ConnectionConfiguration(CHAT_SERVER);
connection = new XMPPConnection(config);
try {
connection.connect();
connection.login(chatLogin, password);
// Chat action 2 -- create chat manager.
chatManager = connection.getChatManager();
// Chat action 3 -- create chat.
chat = chatManager.createChat(friendLogin, messageListener);
// Set listener for outcoming messages.
chatManager.addChatListener(chatManagerListener);
// Muc 2
if(connection != null){
// Get the rooms where user3@host.org has joined
Log.i("User Login =>", chatLogin);
Iterator<String> joinedRooms = MultiUserChat.getJoinedRooms(connection, "732374-5996@chat.quickblox.com");
/*while (joinedRooms.hasNext()) {
Log.i("Rooms =>", (String) joinedRooms.next());
}*/
}
} catch (XMPPException e) {
e.printStackTrace();
}
}
}).start();
}
Logcat =>
12-27 00:38:23.259: E/AndroidRuntime(15395): FATAL EXCEPTION: Thread-3743
12-27 00:38:23.259: E/AndroidRuntime(15395): java.lang.NullPointerException
12-27 00:38:23.259: E/AndroidRuntime(15395): at org.jivesoftware.smackx.muc.MultiUserChat.getRoomInfo(MultiUserChat.java:237)
12-27 00:38:23.259: E/AndroidRuntime(15395): at com.quickblox.sample.chat.MyChatController$3.run(MyChatController.java:95)
12-27 00:38:23.259: E/AndroidRuntime(15395): at java.lang.Thread.run(Thread.java:856)