开发者

Passing a DefaultHttpClient between activites

开发者 https://www.devze.com 2022-12-25 00:48 出处:网络
I am trying to maintain my session variables that I get back in a cookie from my website in my DefaultHttpClient by passing the client between activities.Simply put how can I pass this object between

I am trying to maintain my session variables that I get back in a cookie from my website in my DefaultHttpClient by passing the client between activities. Simply put how can I pass this object between activities to maintain my session variables? Bundle.put... doesn't seem to support this object. If it does how does it work with DefaultHttpClient?

Thanks in开发者_StackOverflow中文版 advance to anyone who can help.


From the Android FAQ: How do I pass data between Activities/Services within a single application

I use the one where you subclass android.app.Application.


You can use the Singleton Pattern (introduced by Gang-of-Four)

Advantage of Singleton:

This is useful when exactly one object is needed to coordinate actions across the system.


An extremely nice piece of sample code I found was this:

http://foo.jasonhudgins.com/2009/08/http-connection-reuse-in-android.html

0

精彩评论

暂无评论...
验证码 换一张
取 消