Problem After removing event listner in android

Post here your questions about the Java client / Android API for SFS2X

Moderators: Lapo, Bax

Posts: 1
Joined: 02 Oct 2018, 16:22

Problem After removing event listner in android

Postby harshdchandel » 02 Oct 2018, 16:44

I am making connection with server in base class the there is landing page ,
matching page and actual game page all using same smartfox object .

I am overwriting extension response in each activity in the start i register listner like this :
sfsClient.addEventListener(SFSEvent.EXTENSION_RESPONSE, this);
and handle event in dispatch method and remove the listner while moving to next activity .

and evrything works fine for the first time for the first time .

if the user clicks on retry ,game activity is called again
I am adding addEventListener again after removal , at this point i am not getting anything in the dispatch .

I have removed and added event listner at the start and end of activity , otherwise my response from the server goes to previous activity.

So my problem is after removing event listner in the same class and re registering I am not able to get repopsnse in dispatch method.

Need Help.
User avatar
Site Admin
Posts: 21588
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Problem After removing event listner in android

Postby Lapo » 05 Oct 2018, 15:26

I've tested removing and re-adding listeners for the same event in a Java client and was not able to reproduce the problem.
Events are always triggered correctly.

Maybe there's something else going on in your code that is causing the issue?
In any case what version of the Java API are you using?

...addicted to flash games

Return to “SFS2X Java / Android API”

Who is online

Users browsing this forum: No registered users and 2 guests