Code example for BasicCookieStore

            // set up one context for all HTTP requests so that authentication 
            // and cookies can be retained. 
            localContext = new SyncBasicHttpContext(new BasicHttpContext());
            // establish a local cookie store for this attempt at downloading... 
            CookieStore cookieStore = new BasicCookieStore();
            localContext.setAttribute(ClientContext.COOKIE_STORE, cookieStore);
            // and establish a credentials provider.  Default is 7 minutes. 
//            CredentialsProvider credsProvider = new AgingCredentialsProvider(7 * 60 * 1000); 
//            localContext.setAttribute(ClientContext.CREDS_PROVIDER, credsProvider); 
        return localContext;
    public void onCreate() { 
        singleton = this;
        PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
Connect your IDE to all the code out there  Get Codota for Java