Code example for DefaultHttpClient

Methods: getCookieStore

    private WebActivity mActivity;
    private Handler mHandler;
    public HmClient(Activity activity){
        mPrefs = activity.getSharedPreferences("auth", Context.MODE_PRIVATE);
        mHttpClient = new DefaultHttpClient();
        if( ! mPrefs.getString("auth_cookie", "").equals("")){
            Log.d(TAG, "stored sid cookie: "+mPrefs.getString("auth_cookie", ""));
            setSidCookie(mPrefs.getString("auth_cookie", ""));
    // used when this hivemind is passed around via onRetainLastNonConfigurationInstance() 
    public void setActivity(WebActivity a){
        this.mActivity = a;
    public WebActivity getActivity(){ 
        return this.mActivity;
    public void setUiHandler(Handler a){
        this.mHandler = a;
    public Handler getUiHandler(){
        return this.mHandler;
    protected void reloadSidCookie(){ 
        if( mPrefs.contains("auth_cookie") ){
            setSidCookie(mPrefs.getString("auth_cookie", ""));
    /** set the session ID cookie for Hiveminder. 
    private void setSidCookie(String cookie){
        BasicClientCookie c = new BasicClientCookie("JIFTY_SID_HIVEMINDER", cookie);
    // save this cookie in our prefs. 
    public void saveSidCookie(){ 
        for( Cookie c : mHttpClient.getCookieStore().getCookies()){
Experience pair programming with AI  Get Codota for Java