title: updating from HttpClient to HttpURLConnection
body: <p>I've been working on an android app, and recently got all of the login code working using <code>HttpClient</code>. However, this code is now deprecated and no longer works. The language summary suggests replacing all <code>HttpClient</code> code with <code>HttpURLConnection</code> objects. I'm not sure how to do that though. If anyone could help me change my code to <code>HttpURLConnection</code> to submit a login form and retrieve information, it would be greatly appreciated. here is my original use-to-function code:</p>
  
  <pre><code>String u = params[0];
  String p = params[1];
  DefaultHttpClient client = new DefaultHttpClient();
  client.getParams().setParameter(ClientPNames.HANDLE_REDIRECTS,Boolean.TRUE);
  //client.setRedirectStrategy(new LaxRedirectStrategy());
  HttpPost post = new HttpPost("https://home-access.cfisd.net/HomeAccess/Account/LogOn");
  List&lt;NameValuePair&gt; list = new ArrayList&lt;NameValuePair&gt;();
  list.add(new BasicNameValuePair("LogOnDetails.Username", u));
  list.add(new BasicNameValuePair("LogOnDetails.Password",p));
  list.add(new BasicNameValuePair("Database","10"));
  HttpResponse response = null;
  try{
      post.setEntity(new UrlEncodedFormEntity(list));
      response = client.execute(post);
  }
  catch(Exception ex)
  {
      ex.printStackTrace();
  }
  </code></pre>