title: How to get cookies after POST request in Android?
body: <p>this is the doInBackground method of my class that extends AsyncTask to do a POST request</p>
  
  <pre><code>@Override
  protected Integer doInBackground(String... arg0) {
  
      HttpClient client = new DefaultHttpClient();
  
      Log.d("HTTP", "URL:" + arg0[0]);
      HttpPost post = new HttpPost(arg0[0]);
  
      try {
          // Add your data
          post.setEntity(new UrlEncodedFormEntity(login)); 
  
          // Execute HTTP Post Request
          HttpResponse response = client.execute(post);
  
          //to Log the response headers
          Header[] headers = response.getAllHeaders();
          for (int i=0; i &lt; headers.length; i++) {
              Header h = headers[i];
              Log.i("Header","Header names: "+h.getName());
              Log.i("Header", "Header Value: "+h.getValue());
          }
  
          int respCode = response.getStatusLine().getStatusCode();
          Log.d("HTTP", "POST:"+arg0[0]+" Risposta Server dopo invio: "+respCode);
  
          return respCode;
      } catch (IOException e) {
          // Gestire nel codice finale
          e.printStackTrace();
      }
  </code></pre>
  
  <p>and this is the logcat:</p>
  
  <blockquote>
    <blockquote>
      <p>01-18 14:44:26.532: I/Header(591): Header names: Date</p>
    </blockquote>
    
    <p>01-18 14:44:26.543: I/Header(591): Header Value: Sat, 18 Jan 2014 14:44:21 GMT</p>
    
    <p>01-18 14:44:26.543: I/Header(591): Header names: Server</p>
    
    <p>01-18 14:44:26.543: I/Header(591): Header Value: Apache</p>
    
    <p>01-18 14:44:26.543: I/Header(591): Header names: Set-Cookie</p>
    
    <p>01-18 14:44:26.543: I/Header(591): Header Value: session_id=29ae962bcc7cbb648c4b2e35b2a7b4f6; path=/; domain=.forumcommunity.net; HttpOnly</p>
    
    <p>01-18 14:44:26.543: I/Header(591): Header names: X-Frame-Options</p>
    
    <p>01-18 14:44:26.553: I/Header(591): Header Value: DENY</p>
    
    <p>01-18 14:44:26.553: I/Header(591): Header names: Set-Cookie</p>
    
    <p>01-18 14:44:26.553: I/Header(591): Header Value: member_id=8712154; expires=Sun, 
    18-Jan-2015 14:44:21 GMT; path=/; domain=.forumcommunity.net; HttpOnly</p>
    
    <p>01-18 14:44:26.553: I/Header(591): Header names: Set-Cookie</p>
    
    <p>01-18 14:44:26.572: I/Header(591): Header Value: pass_hash=83e8e0213aa10058b2d014bc0331598d6076bd23f145d03b6ee8a31b2eb25e96; expires=Sun,  18-Jan-2015 14:44:21 GMT; path=/; domain=.forumcommunity.net; HttpOnly</p>
    
    <p>01-18 14:44:26.572: I/Header(591): Header names: Vary</p>
    
    <p>01-18 14:44:26.572: I/Header(591): Header Value: Accept-Encoding</p>
    
    <p>01-18 14:44:26.572: I/Header(591): Header names: P3P</p>
    
    <p>01-18 14:44:26.582: I/Header(591): Header Value: CP="NOI ADM DEV COM OUR STP"</p>
    
    <p>01-18 14:44:26.582: I/Header(591): Header names: Connection</p>
    
    <p>01-18 14:44:26.582: I/Header(591): Header Value: close</p>
    
    <p>01-18 14:44:26.602: I/Header(591): Header names: Transfer-Encoding</p>
    
    <p>01-18 14:44:26.602: I/Header(591): Header Value: chunked</p>
    
    <p>01-18 14:44:26.602: I/Header(591): Header names: Content-Type</p>
    
    <p>01-18 14:44:26.602: I/Header(591): Header Value: text/html; charset=windows-1252</p>
  </blockquote>
  
  <p>how can I get only the Set-Cookie headers and parse it in a Cookies List?</p>