Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 22nd, 2012  |  syntax: None  |  size: 0.54 KB  |  hits: 18  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Android web server connectivity?
  2. [...]
  3. DefaultHttpClient client = new DefaultHttpClient();
  4. HttpPost httppost = new HttpPost(LOGIN_SERVLET_URI);
  5. List<BasicNameValuePair> params = new ArrayList<BasicNameValuePair>();
  6. params.add(new BasicNameValuePair("userName", userName));
  7. params.add(new BasicNameValuePair("password", password));
  8.  
  9. UrlEncodedFormEntity p_entity = new UrlEncodedFormEntity(params, HTTP.UTF_8);
  10. httppost.setEntity(p_entity);
  11. HttpResponse response = client.execute(httppost);
  12. HttpEntity responseEntity = response.getEntity();
  13. [...]