Hello
I'm trying to post some information for my rest webservice.
HttpPost postMethod = new HttpPost(URL);
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
nameValuePairs.add(new BasicNameValuePair("username","your user
name"));
nameValuePairs.add(new BasicNameValuePair("password","your
password"));
try {
postMethod.setEntity(new UrlEncodedFormEntity(nameValuePairs));
DefaultHttpClient hc = new DefaultHttpClient();
HttpResponse response = hc.execute(postMethod);
Toast.makeText(context, response.getStatusLine().toString(),
Toast.LENGTH_LONG).show();
} catch (ClientProtocolException e) {
Toast.makeText(context, "1: "+e.getMessage(),
Toast.LENGTH_LONG).show();
e.printStackTrace();
} catch (IOException e) {
Toast.makeText(context, "2: "+e.getMessage(),
Toast.LENGTH_LONG).show();
e.printStackTrace();
}
When I clicked in a button I call that method and I'm getting the message
"2: mydomain.com"
Can someone help me?
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en