I am just trying to send my Google account authentication data via HTTP POST. I have built the HTTPpost (URLencoded the ArrayList name - value pair) and executed the HTTPClient to get the HTTPResponse. However this is where the problem starts, the HTTPResponse I get back seems to return an exception anytime I try to call one of its associated methods (getStatusLine or getEntity). I also tried to check for "null" response, by doing a simple "if (null) else" type checking, but still no luck.
Is this problem because I am using the emulator?
-----UPDATE-----
I have found out that I am getting a NULL Pointer response, which causes the exception. So, there is an issue with the way I am accessing the Google API. The URL is "https://www.google.com/accounts/ClientLogin" and "Email" and "Passwd" are the two parameters I use for the POST request.
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("<URL HERE>");
try {
List<NameValuePair> parameters = new ArrayList<NameValuePair>(2);
parameters.add(<name_value_pair>);
parameters.add(<name_value_pair>);
httppost.setEntity(new UrlEncodedFormEntity(parameters));
HttpResponse response = httpclient.execute(httppost);
StatusLine returned_status = response.getStatusLine();
int status_code = returned_status.getStatusCode();
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
} catch (IOException e) {
// TODO Auto-generated catch block
}
}