title: Set a cookie to a webView in Android
body: <p>I'm getting a <code>HttpResponse</code> from a server when checking if a username or password is correct.
  When I load the <code>url</code> in a <code>webview</code> I want the <code>webView</code> to have the cookie (the answer I get with <code>postData()</code> stored in the <code>webView</code>.
  I want the webView to pickup the cookie and load the url with that cookie stored in the webview.</p>
  
  <p>I'm getting the response through.</p>
  
  <pre><code>public HttpResponse postData() {
      HttpClient httpclient = new DefaultHttpClient();
      HttpPost httppost = new HttpPost("https://example.com/login.aspx");
  
      try {
          List&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;(2);
          nameValuePairs.add(new BasicNameValuePair("txtUsername", "user"));
          nameValuePairs.add(new BasicNameValuePair("txtPassword", "123"));
          httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
  
          HttpResponse response = httpclient.execute(httppost);
          String responseAsText = EntityUtils.toString(response.getEntity());
          Log.v(TAG , "Response from req: " + responseAsText);
          return responseAsText;
  
      } catch (ClientProtocolException e) {
  
      } catch (IOException e) {
  
      }
      return null;
  }
  </code></pre>
  
  <p>And I loadUrl with:</p>
  
  <pre><code>webView.loadUrl("http://a_page.com/getpage.aspx?p=home");
  </code></pre>
  
  <p>I guess I'm not really managing a cookie and I have no idea how to do so.
  Any suggestions or solutions?</p>