Android CookieManager
<p>I have an application that makes several web calls in order to get authenticated after which a JSON is returned. My web calls are to an https server and I am using HTTPURlConnection.</p>

<p>I need to store the session in a cookie, after researching around, I found this</p>

<p><a href="http://developer.android.com/reference/java/net/HttpURLConnection.html" rel="nofollow">http://developer.android.com/reference/java/net/HttpURLConnection.html</a></p>

<p>Under the sessions with cookies header, it tells you to use this code here</p>

<pre><code>   CookieManager cookieManager = new CookieManager();
   CookieHandler.setDefault(cookieManager);
</code></pre>

<p>However when I try using this code, the new CookieManager(); part highlights in red and says </p>

<blockquote>
  <p>The constructor CookieManager is not visible</p>
</blockquote>

<p>and the Cookiehandler.setDefault also highlights in red and says</p>

<blockquote>
  <p>The method setDefault(CookieHandler) in the type CookieHandler is not applicable for the arguments (CookieManager)</p>
</blockquote>

<p>Does anyone know why this is? </p>

<p>Thanks in advance!</p>
