0

Is there a way other then, open/close sockets, when u use sockets on multiple activity's within the app?

Can I somehow send a instance of a object to the new activity(the class uses activity object from parent), and change them? use a service?

What would bee the best way to use same socket on multiple activity's

mc_fish
  • 493
  • 3
  • 10

1 Answers1

0

You could just put all the network communication in a single service and access that single service from all the separate activities. Also, make sure that you do all your network communication on a different thread than the UI thread. Try using an IntentService. If you do do your network communication on the UI thread, your going to slow down you app and probably get Application Not Responding messages.

Kurtis Nusbaum
  • 30,445
  • 13
  • 78
  • 102
  • i cannot use services, because i need to send the activity object as a parameter. – mc_fish Oct 27 '11 at 08:58
  • You're sending the activity over a socket? – Kurtis Nusbaum Oct 27 '11 at 13:15
  • no, i send the activity object for context etc to a class(for communication), and when i change activity's throughout the app, socket stay opened...i would like to open them once, not every time a activity is started – mc_fish Oct 27 '11 at 22:52