How to recieve message in create chat

i create connection in a class n pass that connection to another class,in which i create a chat,problem is this i send the message to participant but can’'t recieve,cause there is no event fire in process packet,but when i use create chat in same class,n before login i add connectionlistner,n packetlistner then i receive message from participant, i give both code can anybody suggest me what i do wrong

code when i use all in single class its working perfect :

connect = new XMPPConnection(“”,5222);


connect.addPacketListener(this,new MessageTypeFilter(Message.Type.CHAT));

connect.login(“guest”, “guest”);

chatjamer = connect.createChat(participant);

chatjamer.sendMessage(“Hello how r u?”);

but when i pass connect in different class after login

and add packetListner and createchat then it is not working n i cant receive any message from the participant