AnsweredAssumed Answered

Android chat using smack

Question asked by eyreena on Oct 2, 2015

Hello  everyone,

Following is  a code snippet from chat.java class of Smack library, in some case the number of listeners is zero, and my chat wont works but when the listeners is created chat works,

but i am unable to understand under which conditions the listeners are created successfully, can anyone suggest me the reason .

 

void deliver(Message message) {

        // Because the collector and listeners are expecting a thread ID with

        // a specific value, set the thread ID on the message even though it

        // probably never had one.

        message.setThread(threadID);

 

 

        for (MessageListener listener : listeners) {

            listener.processMessage(this, message);

        }

    }

Outcomes