powered by Jive Software

How to implement offline and reuse roster and listener

I am using openfire and asmack lib. I am implementing online and offline button in android chat application .How can I set my presence “unavailable”.

Note: I don’t want to use connection.disconnect() method ,because **

This method cleans up all resources used by the connection. Therefore, the roster, listeners and other stateful objects cannot be re-used by simply calling connect() on this connection again. This is unlike the behavior during unexpected disconnects (and subsequent connections). In that case, all state is preserved to allow for more seamless error recovery.


But I need to reuse roster and listeners when I click online button. So what should I do.