powered by Jive Software

Unable to getjoined chat rooms - android smack

Hi
i al developing an instant messaging application in android using smack library 4.2.2,
i was able to implement one to one chat, but with muc I’ve got trouble in getJoindRoom(),
I’ve tried a lot of things but nothing seems to be working
i just want to create some mucs and join some of them ,then show those i joined
please any help
thanks a lot
this is my code
MultiUserChatManager manager = MultiUserChatManager.getInstanceFor(connection);
jid = JidCreate.fullFrom(“admin@localhost”);
ListjoinedRooms=manager.getJoinedRooms((EntityJid) jid);
for (int i=0;i<joinedRooms.size();i++)
System.out.println(" the user has joined into "+joinedRooms.get(i));

Just a quick heads up. This smack is very old, the current stable release is 4.3.4. And I, unfortunately, do not have the resources to provide support for old versions as part of my spare time Smack work (maybe someone else has). But you definitely should consider upgrading to the current stable release of Smack.

Hi thanks
i’have upgraded the library to the current one , and also solved my problem ( i have changed the return type of getJoinedRoom() from a List to a Set like this :

public static Set getJoinedRooms(XmppTCPConnection con) throws Exceptions *{
      Set result =new HashSet();
       if(con!=null) {
            MultiUserChatManager manager=MultiUserChatManager.getInstanceFor(connection);
            result= manager.getJoinedRooms();
       } return result;
}`
to print the result 
private Set myRooms =myClass.getJoinedRooms();
Iterator iterator = myRooms.iterator();

while (iterator.hasNext())
            System.out.println("THIS USER JOIND THIS "+iterator.next().toString());

This topic was automatically closed 62 days after the last reply. New replies are no longer allowed.