UPDATE: This question and its answers should no longer be recommended to anyone reading this. Android no-longer recommends HttpClient (read: deprecated), and instead
Make your httpClient a singleton class.
Don't create new HttpClients; this will clear the cookies. Reuse a single HttpClient.
define HttpClient in Application class, and use it in activity.
in Application
public class AAA extends Application {
public HttpClient httpClient;
httpClient = new DefaultHttpClient();
in Activity
AAA aaa = (AAA)getApplication();
httpClient = app.httpClient;
You can do what @Emmanuel suggested or you can pass the BasicHttpContext between the HttpClients you are creating.
Example Use of context and cookies, complete code here
HttpClient httpclient = new DefaultHttpClient();
// Create a local instance of cookie store
CookieStore cookieStore = new BasicCookieStore();
// Create local HTTP context
HttpContext localContext = new BasicHttpContext();
// Bind custom cookie store to the local context
localContext.setAttribute(ClientContext.COOKIE_STORE, cookieStore);
HttpGet httpget = new HttpGet("http://www.google.com/", localContext);