socket.io-client-java icon indicating copy to clipboard operation
socket.io-client-java copied to clipboard

How can i pass my socket object to another activity in android?

Open xro7 opened this issue 11 years ago • 4 comments

I tried to use intent but i doesnt work. Also i tried to create a SocketHandler class with static methods but i dont think this is the best thing to do. Any ideas?

xro7 avatar Sep 27 '15 14:09 xro7

You can use a custom Application class to store that. It is shared across all Activities. Maybe this tutorial helps you: http://www.intertech.com/Blog/androids-application-class/

ReneHollander avatar Sep 28 '15 11:09 ReneHollander

Nice thank you!

xro7 avatar Sep 28 '15 12:09 xro7

@ReneHollander thanks!

nkzawa avatar Sep 29 '15 03:09 nkzawa

@ReneHollander We need to make socket singleton in application class then we can not emit with different listeners as it will static. We can't emit from multiple activity if we will do then we will receive response in last open activity. share any solution for this case. Thank you

deepbhavsar avatar Jun 05 '19 13:06 deepbhavsar