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
精彩评论