Sharing socket / network handle

Put your problem here if it does not fit any of the other categories.

Sharing socket / network handle

Postby ethrbunny » Thu Jun 25, 2009 4:16 pm

I have a TabActivity based app. Im hoping to create my socket/RPC handle in the main create code and share it with the tab activities. It doesn't appear that Intent.putExtra supports 'Object' anymore and Im wondering if this is due to a memory context issue.

Suggestions on a better way for me to pass this network handle to my tabs?
ethrbunny
Junior Developer
Junior Developer
 
Posts: 10
Joined: Thu Jun 25, 2009 4:09 pm

Top

Postby boxpei » Fri Jun 26, 2009 7:14 am

hi,ethrbunny.

In this case i think using service is a good idea.

You should write a Service to handle all your
network accesses. All of your Activities will have access to that Service,
and can invoke methods on it. The Service will hold on to the network
datagram socket connection, and does network accesses on behalf of your
Activities. In this way you only need to have one copy of the socket.

Best regards
boxpei
Once Poster
Once Poster
 
Posts: 1
Joined: Tue Jun 16, 2009 10:52 am

Postby ethrbunny » Fri Jun 26, 2009 1:27 pm

That's an interesting idea. I had found that I can store a 'global' using the 'getApplication' function. Maybe your idea is better? I'll poke into it.

Thanks.
ethrbunny
Junior Developer
Junior Developer
 
Posts: 10
Joined: Thu Jun 25, 2009 4:09 pm

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: MSNbot Media and 9 guests